Debian Codegraph @

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

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