Debian Codegraph @

gopls/internal/test/marker/testdata/codeaction/grouplines.txt

raw
1 This test exercises the refactoring of putting arguments, return values, and composite literal elements into a
2 single line.
3
4 -- go.mod --
5 module unused.mod
6
7 go 1.18
8
9 -- func_arg/func_arg.go --
10 package func_arg
11
12 func A(
13 a string,
14 b, c int64,
15 x int /*@codeaction("x", "refactor.rewrite.joinLines", result=func_arg)*/,
16 y int,
17 ) (r1 string, r2, r3 int64, r4 int, r5 int) {
18 return a, b, c, x, y
19 }
20
21 -- @func_arg/func_arg/func_arg.go --
22 package func_arg
23
24 func A(a string, b, c int64, x int /*@codeaction("x", "refactor.rewrite.joinLines", result=func_arg)*/, y int) (r1 string, r2, r3 int64, r4 int, r5 int) {
25 return a, b, c, x, y
26 }
27
28 -- func_ret/func_ret.go --
29 package func_ret
30
31 func A(a string, b, c int64, x int, y int) (
32 r1 string /*@codeaction("r1", "refactor.rewrite.joinLines", result=func_ret)*/,
33 r2, r3 int64,
34 r4 int,
35 r5 int,
36 ) {
37 return a, b, c, x, y
38 }
39
40 -- @func_ret/func_ret/func_ret.go --
41 package func_ret
42
43 func A(a string, b, c int64, x int, y int) (r1 string /*@codeaction("r1", "refactor.rewrite.joinLines", result=func_ret)*/, r2, r3 int64, r4 int, r5 int) {
44 return a, b, c, x, y
45 }
46
47 -- functype_arg/functype_arg.go --
48 package functype_arg
49
50 type A func(
51 a string,
52 b, c int64,
53 x int /*@codeaction("x", "refactor.rewrite.joinLines", result=functype_arg)*/,
54 y int,
55 ) (r1 string, r2, r3 int64, r4 int, r5 int)
56
57 -- @functype_arg/functype_arg/functype_arg.go --
58 package functype_arg
59
60 type A func(a string, b, c int64, x int /*@codeaction("x", "refactor.rewrite.joinLines", result=functype_arg)*/, y int) (r1 string, r2, r3 int64, r4 int, r5 int)
61
62 -- functype_ret/functype_ret.go --
63 package functype_ret
64
65 type A func(a string, b, c int64, x int, y int) (
66 r1 string /*@codeaction("r1", "refactor.rewrite.joinLines", result=functype_ret)*/,
67 r2, r3 int64,
68 r4 int,
69 r5 int,
70 )
71
72 -- @functype_ret/functype_ret/functype_ret.go --
73 package functype_ret
74
75 type A func(a string, b, c int64, x int, y int) (r1 string /*@codeaction("r1", "refactor.rewrite.joinLines", result=functype_ret)*/, r2, r3 int64, r4 int, r5 int)
76
77 -- func_call/func_call.go --
78 package func_call
79
80 import "fmt"
81
82 func F() {
83 fmt.Println(
84 1 /*@codeaction("1", "refactor.rewrite.joinLines", result=func_call)*/,
85 2,
86 3,
87 fmt.Sprintf("hello %d", 4),
88 )
89 }
90
91 -- @func_call/func_call/func_call.go --
92 package func_call
93
94 import "fmt"
95
96 func F() {
97 fmt.Println(1 /*@codeaction("1", "refactor.rewrite.joinLines", result=func_call)*/, 2, 3, fmt.Sprintf("hello %d", 4))
98 }
99
100 -- indent/indent.go --
101 package indent
102
103 import "fmt"
104
105 func F() {
106 fmt.Println(
107 1,
108 2,
109 3,
110 fmt.Sprintf(
111 "hello %d" /*@codeaction("hello", "refactor.rewrite.joinLines", result=indent)*/,
112 4,
113 ))
114 }
115
116 -- @indent/indent/indent.go --
117 package indent
118
119 import "fmt"
120
121 func F() {
122 fmt.Println(
123 1,
124 2,
125 3,
126 fmt.Sprintf("hello %d" /*@codeaction("hello", "refactor.rewrite.joinLines", result=indent)*/, 4))
127 }
128
129 -- structelts/structelts.go --
130 package structelts
131
132 type A struct{
133 a int
134 b int
135 }
136
137 func F() {
138 _ = A{
139 a: 1,
140 b: 2 /*@codeaction("b", "refactor.rewrite.joinLines", result=structelts)*/,
141 }
142 }
143
144 -- @structelts/structelts/structelts.go --
145 package structelts
146
147 type A struct{
148 a int
149 b int
150 }
151
152 func F() {
153 _ = A{a: 1, b: 2 /*@codeaction("b", "refactor.rewrite.joinLines", result=structelts)*/}
154 }
155
156 -- sliceelts/sliceelts.go --
157 package sliceelts
158
159 func F() {
160 _ = []int{
161 1 /*@codeaction("1", "refactor.rewrite.joinLines", result=sliceelts)*/,
162 2,
163 }
164 }
165
166 -- @sliceelts/sliceelts/sliceelts.go --
167 package sliceelts
168
169 func F() {
170 _ = []int{1 /*@codeaction("1", "refactor.rewrite.joinLines", result=sliceelts)*/, 2}
171 }
172
173 -- mapelts/mapelts.go --
174 package mapelts
175
176 func F() {
177 _ = map[string]int{
178 "a": 1 /*@codeaction("1", "refactor.rewrite.joinLines", result=mapelts)*/,
179 "b": 2,
180 }
181 }
182
183 -- @mapelts/mapelts/mapelts.go --
184 package mapelts
185
186 func F() {
187 _ = map[string]int{"a": 1 /*@codeaction("1", "refactor.rewrite.joinLines", result=mapelts)*/, "b": 2}
188 }
189
190 -- starcomment/starcomment.go --
191 package starcomment
192
193 func A(
194 /*1*/ x /*2*/ string /*3*/ /*@codeaction("x", "refactor.rewrite.joinLines", result=starcomment)*/,
195 /*4*/ y /*5*/ int /*6*/,
196 ) (string, int) {
197 return x, y
198 }
199
200 -- @starcomment/starcomment/starcomment.go --
201 package starcomment
202
203 func A(/*1*/ x /*2*/ string /*3*/ /*@codeaction("x", "refactor.rewrite.joinLines", result=starcomment)*/, /*4*/ y /*5*/ int /*6*/) (string, int) {
204 return x, y
205 }
206