Debian Codegraph @

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

raw
1 This test checks that function extraction moves comments along with the
2 extracted code.
3
4 -- main.go --
5 package main
6
7 type F struct{}
8
9 func (f *F) _() {
10 println("a")
11
12 println("b") //@ codeaction("print", "refactor.extract.function", end=end, result=result)
13 // This line prints the third letter of the alphabet.
14 println("c") //@loc(end, ")")
15
16 println("d")
17 }
18 -- @result/main.go --
19 package main
20
21 type F struct{}
22
23 func (f *F) _() {
24 println("a")
25
26 newFunction() //@loc(end, ")")
27
28 println("d")
29 }
30
31 func newFunction() {
32 println("b") //@ codeaction("print", "refactor.extract.function", end=end, result=result)
33 // This line prints the third letter of the alphabet.
34 println("c")
35 }