File tree Expand file tree Collapse file tree 1 file changed +15
-19
lines changed
gopls/internal/regtest/misc Expand file tree Collapse file tree 1 file changed +15
-19
lines changed Original file line number Diff line number Diff line change @@ -23,39 +23,35 @@ go 1.14
23
23
-- main.go --
24
24
package main
25
25
26
- import "go/types"
26
+ type Info struct {
27
+ WordCounts map[string]int
28
+ Words []string
29
+ }
27
30
28
31
func Foo() {
29
- _ = types. Info{}
32
+ _ = Info{}
30
33
}
31
34
`
32
35
Run (t , basic , func (t * testing.T , env * Env ) {
33
36
env .OpenFile ("main.go" )
37
+ pos := env .RegexpSearch ("main.go" , "Info{}" ).ToProtocolPosition ()
34
38
if err := env .Editor .RefactorRewrite (env .Ctx , "main.go" , & protocol.Range {
35
- Start : protocol.Position {
36
- Line : 5 ,
37
- Character : 16 ,
38
- },
39
- End : protocol.Position {
40
- Line : 5 ,
41
- Character : 16 ,
42
- },
39
+ Start : pos ,
40
+ End : pos ,
43
41
}); err != nil {
44
42
t .Fatal (err )
45
43
}
46
44
want := `package main
47
45
48
- import "go/types"
46
+ type Info struct {
47
+ WordCounts map[string]int
48
+ Words []string
49
+ }
49
50
50
51
func Foo() {
51
- _ = types.Info{
52
- Types: map[ast.Expr]types.TypeAndValue{},
53
- Defs: map[*ast.Ident]types.Object{},
54
- Uses: map[*ast.Ident]types.Object{},
55
- Implicits: map[ast.Node]types.Object{},
56
- Selections: map[*ast.SelectorExpr]*types.Selection{},
57
- Scopes: map[ast.Node]*types.Scope{},
58
- InitOrder: []*types.Initializer{},
52
+ _ = Info{
53
+ WordCounts: map[string]int{},
54
+ Words: []string{},
59
55
}
60
56
}
61
57
`
You can’t perform that action at this time.
0 commit comments