| 1 |
This is a test of the refactor.inline.variable code action. |
| 2 |
|
| 3 |
-- go.mod -- |
| 4 |
module example.com/a |
| 5 |
go 1.18 |
| 6 |
|
| 7 |
-- a/a.go -- |
| 8 |
package a |
| 9 |
|
| 10 |
import "fmt" |
| 11 |
|
| 12 |
func _(x int) { |
| 13 |
s := fmt.Sprintf("+%d", x) |
| 14 |
println(s) //@codeaction("s", "refactor.inline.variable", result=inlineS) |
| 15 |
} |
| 16 |
|
| 17 |
-- @inlineS/a/a.go -- |
| 18 |
package a |
| 19 |
|
| 20 |
import "fmt" |
| 21 |
|
| 22 |
func _(x int) { |
| 23 |
s := fmt.Sprintf("+%d", x) |
| 24 |
println(fmt.Sprintf("+%d", x)) //@codeaction("s", "refactor.inline.variable", result=inlineS) |
| 25 |
} |
| 26 |
|
| 27 |
-- b/b.go -- |
| 28 |
package b |
| 29 |
|
| 30 |
import "fmt" |
| 31 |
|
| 32 |
func _(x int) { |
| 33 |
s2 := fmt.Sprintf("+%d", x) |
| 34 |
{ |
| 35 |
x := "shadow" |
| 36 |
println(s2, x) //@codeaction("s2", "refactor.inline.variable", err=re`refers to "x".*shadowed.*at line 8`) |
| 37 |
} |
| 38 |
} |