internal/lsp: move fillstruct suggested fixes out of analysis
This change moves the suggested fixes logic for fillstruct out of the
analysis and into internal/lsp/source. This logic is then used as part
of a new fillstruct command. This command is returned along with the
code action results, to be executed only when the user accepts the code
action.
This led to a number of changes to testing. The suggested fix tests in
internal/lsp doesn't support executing commands, so we skip them. The
suggested fix tests in internal/lsp/source are changed to call
fillstruct directly. A new regtest is added to check the command
execution, which led to a few regtest changes.
Also, remove the `go mod tidy` code action, as it's made redundant by
the existence of the suggested fixes coming from internal/lsp/mod.
Change-Id: I35ca0aff1ace8f0097fe7cb57232997facb516a4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/241983
Reviewed-by: Heschi Kreinick <heschi@google.com>
diff --git a/internal/lsp/analysis/fillstruct/fillstruct.go b/internal/lsp/analysis/fillstruct/fillstruct.go
index 8583a58..bb09629 100644
--- a/internal/lsp/analysis/fillstruct/fillstruct.go
+++ b/internal/lsp/analysis/fillstruct/fillstruct.go
@@ -11,34 +11,24 @@
"fmt"
"go/ast"
"go/format"
- "go/printer"
"go/token"
"go/types"
"log"
- "strings"
"unicode"
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/analysis/passes/inspect"
+ "golang.org/x/tools/go/ast/astutil"
"golang.org/x/tools/go/ast/inspector"
"golang.org/x/tools/internal/analysisinternal"
)
-const Doc = `suggested input for incomplete struct initializations
+const Doc = `note incomplete struct initializations
-This analyzer provides the appropriate zero values for all
-uninitialized fields of an empty struct. For example, given the following struct:
- type Foo struct {
- ID int64
- Name string
- }
-the initialization
- var _ = Foo{}
-will turn into
- var _ = Foo{
- ID: 0,
- Name: "",
- }
+This analyzer provides diagnostics for any struct literals that do not have
+any fields initialized. Because the suggested fix for this analysis is
+expensive to compute, callers should compute it separately, using the
+SuggestedFix function below.
`
var Analyzer = &analysis.Analyzer{
@@ -95,11 +85,24 @@
return
}
fieldCount := obj.NumFields()
+
// Skip any struct that is already populated or that has no fields.
if fieldCount == 0 || fieldCount == len(expr.Elts) {
return
}
+ var fillable bool
+ for i := 0; i < fieldCount; i++ {
+ field := obj.Field(i)
+ // Ignore fields that are not accessible in the current package.
+ if field.Pkg() != nil && field.Pkg() != pass.Pkg && !field.Exported() {
+ continue
+ }
+ fillable = true
+ }
+ if !fillable {
+ return
+ }
var name string
switch typ := expr.Type.(type) {
case *ast.Ident:
@@ -109,119 +112,153 @@
default:
name = "anonymous struct"
}
-
- // Use a new fileset to build up a token.File for the new composite
- // literal. We need one line for foo{, one line for }, and one line for
- // each field we're going to set. format.Node only cares about line
- // numbers, so we don't need to set columns, and each line can be
- // 1 byte long.
- fset := token.NewFileSet()
- tok := fset.AddFile("", -1, fieldCount+2)
-
- line := 2 // account for 1-based lines and the left brace
- var elts []ast.Expr
- for i := 0; i < fieldCount; i++ {
- field := obj.Field(i)
-
- // Ignore fields that are not accessible in the current package.
- if field.Pkg() != nil && field.Pkg() != pass.Pkg && !field.Exported() {
- continue
- }
-
- value := populateValue(pass.Fset, file, pass.Pkg, field.Type())
- if value == nil {
- continue
- }
-
- tok.AddLine(line - 1) // add 1 byte per line
- if line > tok.LineCount() {
- panic(fmt.Sprintf("invalid line number %v (of %v) for fillstruct %s", line, tok.LineCount(), name))
- }
- pos := tok.LineStart(line)
-
- kv := &ast.KeyValueExpr{
- Key: &ast.Ident{
- NamePos: pos,
- Name: field.Name(),
- },
- Colon: pos,
- Value: value,
- }
- elts = append(elts, kv)
- line++
- }
-
- // If all of the struct's fields are unexported, we have nothing to do.
- if len(elts) == 0 {
- return
- }
-
- // Add the final line for the right brace. Offset is the number of
- // bytes already added plus 1.
- tok.AddLine(len(elts) + 1)
- line = len(elts) + 2
- if line > tok.LineCount() {
- panic(fmt.Sprintf("invalid line number %v (of %v) for fillstruct %s", line, tok.LineCount(), name))
- }
-
- cl := &ast.CompositeLit{
- Type: expr.Type,
- Lbrace: tok.LineStart(1),
- Elts: elts,
- Rbrace: tok.LineStart(line),
- }
-
- // Print the AST to get the the original source code.
- var b bytes.Buffer
- if err := printer.Fprint(&b, pass.Fset, file); err != nil {
- log.Printf("failed to print original file: %s", err)
- return
- }
-
- // Find the line on which the composite literal is declared.
- split := strings.Split(b.String(), "\n")
- lineNumber := pass.Fset.Position(expr.Lbrace).Line
- firstLine := split[lineNumber-1] // lines are 1-indexed
-
- // Trim the whitespace from the left of the line, and use the index
- // to get the amount of whitespace on the left.
- trimmed := strings.TrimLeftFunc(firstLine, unicode.IsSpace)
- index := strings.Index(firstLine, trimmed)
- whitespace := firstLine[:index]
-
- var newExpr bytes.Buffer
- if err := format.Node(&newExpr, fset, cl); err != nil {
- log.Printf("failed to format %s: %v", cl.Type, err)
- return
- }
- split = strings.Split(newExpr.String(), "\n")
- var newText strings.Builder
- for i, s := range split {
- // Don't add the extra indentation to the first line.
- if i != 0 {
- newText.WriteString(whitespace)
- }
- newText.WriteString(s)
- if i < len(split)-1 {
- newText.WriteByte('\n')
- }
- }
pass.Report(analysis.Diagnostic{
- Pos: expr.Lbrace,
- End: expr.Rbrace,
- SuggestedFixes: []analysis.SuggestedFix{{
- Message: fmt.Sprintf("Fill %s with default values", name),
- TextEdits: []analysis.TextEdit{{
- Pos: expr.Pos(),
- End: expr.End(),
- NewText: []byte(newText.String()),
- }},
- }},
+ Message: fmt.Sprintf("Fill %s with default values", name),
+ Pos: expr.Lbrace,
+ End: expr.Rbrace,
})
})
return nil, nil
}
+func SuggestedFix(fset *token.FileSet, pos token.Pos, content []byte, file *ast.File, pkg *types.Package, info *types.Info) (*analysis.SuggestedFix, error) {
+ // TODO(rstambler): Using ast.Inspect would probably be more efficient than
+ // calling PathEnclosingInterval. Switch this approach.
+ path, _ := astutil.PathEnclosingInterval(file, pos, pos)
+ if len(path) == 0 {
+ return nil, fmt.Errorf("no enclosing ast.Node")
+ }
+ var expr *ast.CompositeLit
+ for _, n := range path {
+ if node, ok := n.(*ast.CompositeLit); ok {
+ expr = node
+ break
+ }
+ }
+ if info == nil {
+ return nil, fmt.Errorf("nil types.Info")
+ }
+ typ := info.TypeOf(expr)
+ if typ == nil {
+ return nil, fmt.Errorf("no composite literal")
+ }
+
+ // Find reference to the type declaration of the struct being initialized.
+ for {
+ p, ok := typ.Underlying().(*types.Pointer)
+ if !ok {
+ break
+ }
+ typ = p.Elem()
+ }
+ typ = typ.Underlying()
+
+ obj, ok := typ.(*types.Struct)
+ if !ok {
+ return nil, fmt.Errorf("unexpected type %v (%T), expected *types.Struct", typ, typ)
+ }
+ fieldCount := obj.NumFields()
+
+ // Use a new fileset to build up a token.File for the new composite
+ // literal. We need one line for foo{, one line for }, and one line for
+ // each field we're going to set. format.Node only cares about line
+ // numbers, so we don't need to set columns, and each line can be
+ // 1 byte long.
+ fakeFset := token.NewFileSet()
+ tok := fakeFset.AddFile("", -1, fieldCount+2)
+
+ line := 2 // account for 1-based lines and the left brace
+ var elts []ast.Expr
+ for i := 0; i < fieldCount; i++ {
+ field := obj.Field(i)
+
+ // Ignore fields that are not accessible in the current package.
+ if field.Pkg() != nil && field.Pkg() != pkg && !field.Exported() {
+ continue
+ }
+
+ value := populateValue(fset, file, pkg, field.Type())
+ if value == nil {
+ continue
+ }
+
+ tok.AddLine(line - 1) // add 1 byte per line
+ if line > tok.LineCount() {
+ panic(fmt.Sprintf("invalid line number %v (of %v) for fillstruct", line, tok.LineCount()))
+ }
+ pos := tok.LineStart(line)
+
+ kv := &ast.KeyValueExpr{
+ Key: &ast.Ident{
+ NamePos: pos,
+ Name: field.Name(),
+ },
+ Colon: pos,
+ Value: value,
+ }
+ elts = append(elts, kv)
+ line++
+ }
+
+ // If all of the struct's fields are unexported, we have nothing to do.
+ if len(elts) == 0 {
+ return nil, fmt.Errorf("no elements to fill")
+ }
+
+ // Add the final line for the right brace. Offset is the number of
+ // bytes already added plus 1.
+ tok.AddLine(len(elts) + 1)
+ line = len(elts) + 2
+ if line > tok.LineCount() {
+ panic(fmt.Sprintf("invalid line number %v (of %v) for fillstruct", line, tok.LineCount()))
+ }
+
+ cl := &ast.CompositeLit{
+ Type: expr.Type,
+ Lbrace: tok.LineStart(1),
+ Elts: elts,
+ Rbrace: tok.LineStart(line),
+ }
+
+ // Find the line on which the composite literal is declared.
+ split := bytes.Split(content, []byte("\n"))
+ lineNumber := fset.Position(expr.Lbrace).Line
+ firstLine := split[lineNumber-1] // lines are 1-indexed
+
+ // Trim the whitespace from the left of the line, and use the index
+ // to get the amount of whitespace on the left.
+ trimmed := bytes.TrimLeftFunc(firstLine, unicode.IsSpace)
+ index := bytes.Index(firstLine, trimmed)
+ whitespace := firstLine[:index]
+
+ var newExpr bytes.Buffer
+ if err := format.Node(&newExpr, fakeFset, cl); err != nil {
+ log.Printf("failed to format %s: %v", cl.Type, err)
+ return nil, err
+ }
+ split = bytes.Split(newExpr.Bytes(), []byte("\n"))
+ newText := bytes.NewBuffer(nil)
+ for i, s := range split {
+ // Don't add the extra indentation to the first line.
+ if i != 0 {
+ newText.Write(whitespace)
+ }
+ newText.Write(s)
+ if i < len(split)-1 {
+ newText.WriteByte('\n')
+ }
+ }
+ return &analysis.SuggestedFix{
+ TextEdits: []analysis.TextEdit{
+ {
+ Pos: expr.Pos(),
+ End: expr.End(),
+ NewText: newText.Bytes(),
+ },
+ },
+ }, nil
+}
+
// populateValue constructs an expression to fill the value of a struct field.
//
// When the type of a struct field is a basic literal or interface, we return
@@ -278,7 +315,8 @@
Type: &ast.ArrayType{
Elt: a,
Len: &ast.BasicLit{
- Kind: token.INT, Value: fmt.Sprintf("%v", u.Len())},
+ Kind: token.INT, Value: fmt.Sprintf("%v", u.Len()),
+ },
},
}
case *types.Chan:
diff --git a/internal/lsp/analysis/fillstruct/fillstruct_test.go b/internal/lsp/analysis/fillstruct/fillstruct_test.go
index cdd1bde..34c9923e 100644
--- a/internal/lsp/analysis/fillstruct/fillstruct_test.go
+++ b/internal/lsp/analysis/fillstruct/fillstruct_test.go
@@ -13,5 +13,5 @@
func Test(t *testing.T) {
testdata := analysistest.TestData()
- analysistest.RunWithSuggestedFixes(t, testdata, fillstruct.Analyzer, "a")
+ analysistest.Run(t, testdata, fillstruct.Analyzer, "a")
}
diff --git a/internal/lsp/analysis/fillstruct/testdata/src/a/a.go.golden b/internal/lsp/analysis/fillstruct/testdata/src/a/a.go.golden
deleted file mode 100644
index 9070311..0000000
--- a/internal/lsp/analysis/fillstruct/testdata/src/a/a.go.golden
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright 2020 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package fillstruct
-
-import (
- data "b"
- "go/ast"
- "go/token"
-)
-
-type emptyStruct struct{}
-
-var _ = emptyStruct{}
-
-type basicStruct struct {
- foo int
-}
-
-var _ = basicStruct{
- foo: 0,
-} // want ""
-
-type twoArgStruct struct {
- foo int
- bar string
-}
-
-var _ = twoArgStruct{
- foo: 0,
- bar: "",
-} // want ""
-
-var _ = twoArgStruct{
- bar: "bar",
-}
-
-type nestedStruct struct {
- bar string
- basic basicStruct
-}
-
-var _ = nestedStruct{
- bar: "",
- basic: basicStruct{},
-} // want ""
-
-var _ = data.B{
- ExportedInt: 0,
-} // want ""
-
-type typedStruct struct {
- m map[string]int
- s []int
- c chan int
- c1 <-chan int
- a [2]string
-}
-
-var _ = typedStruct{
- m: map[string]int{},
- s: []int{},
- c: make(chan int),
- c1: make(<-chan int),
- a: [2]string{},
-} // want ""
-
-type funStruct struct {
- fn func(i int) int
-}
-
-var _ = funStruct{
- fn: func(i int) int {
- },
-} // want ""
-
-type funStructCompex struct {
- fn func(i int, s string) (string, int)
-}
-
-var _ = funStructCompex{
- fn: func(i int, s string) (string, int) {
- },
-} // want ""
-
-type funStructEmpty struct {
- fn func()
-}
-
-var _ = funStructEmpty{
- fn: func() {
- },
-} // want ""
-
-type Foo struct {
- A int
-}
-
-type Bar struct {
- X *Foo
- Y *Foo
-}
-
-var _ = Bar{
- X: &Foo{},
- Y: &Foo{},
-} // want ""
-
-type importedStruct struct {
- m map[*ast.CompositeLit]ast.Field
- s []ast.BadExpr
- a [3]token.Token
- c chan ast.EmptyStmt
- fn func(ast_decl ast.DeclStmt) ast.Ellipsis
- st ast.CompositeLit
-}
-
-var _ = importedStruct{
- m: map[*ast.CompositeLit]ast.Field{},
- s: []ast.BadExpr{},
- a: [3]token.Token{},
- c: make(chan ast.EmptyStmt),
- fn: func(ast_decl ast.DeclStmt) ast.Ellipsis {
- },
- st: ast.CompositeLit{},
-} // want ""
-
-type pointerBuiltinStruct struct {
- b *bool
- s *string
- i *int
-}
-
-var _ = pointerBuiltinStruct{
- b: new(bool),
- s: new(string),
- i: new(int),
-} // want ""
-
-var _ = []ast.BasicLit{
- {
- ValuePos: 0,
- Kind: 0,
- Value: "",
- }, // want ""
-}
-
-var _ = []ast.BasicLit{{
- ValuePos: 0,
- Kind: 0,
- Value: "",
-}, // want ""
-}
diff --git a/internal/lsp/code_action.go b/internal/lsp/code_action.go
index cdeb263..adc2120 100644
--- a/internal/lsp/code_action.go
+++ b/internal/lsp/code_action.go
@@ -6,6 +6,7 @@
import (
"context"
+ "encoding/json"
"fmt"
"sort"
"strings"
@@ -13,6 +14,7 @@
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/internal/event"
"golang.org/x/tools/internal/imports"
+ "golang.org/x/tools/internal/lsp/analysis/fillstruct"
"golang.org/x/tools/internal/lsp/debug/tag"
"golang.org/x/tools/internal/lsp/mod"
"golang.org/x/tools/internal/lsp/protocol"
@@ -51,24 +53,13 @@
var codeActions []protocol.CodeAction
switch fh.Kind() {
case source.Mod:
- if diagnostics := params.Context.Diagnostics; len(diagnostics) > 0 {
+ if diagnostics := params.Context.Diagnostics; wanted[protocol.SourceOrganizeImports] || len(diagnostics) > 0 {
modFixes, err := mod.SuggestedFixes(ctx, snapshot, diagnostics)
if err != nil {
return nil, err
}
codeActions = append(codeActions, modFixes...)
}
- if wanted[protocol.SourceOrganizeImports] {
- codeActions = append(codeActions, protocol.CodeAction{
- Title: "Tidy",
- Kind: protocol.SourceOrganizeImports,
- Command: &protocol.Command{
- Title: "Tidy",
- Command: "tidy",
- Arguments: []interface{}{fh.URI()},
- },
- })
- }
case source.Go:
// Don't suggest fixes for generated files, since they are generally
// not useful and some editors may apply them automatically on save.
@@ -336,22 +327,30 @@
if d.Range.Start.Line != rng.Start.Line {
continue
}
- for _, fix := range d.SuggestedFixes {
- action := protocol.CodeAction{
- Title: fix.Title,
- Kind: protocol.RefactorRewrite,
- Edit: protocol.WorkspaceEdit{},
+ // The fix depends on the category of the analyzer.
+ switch d.Category {
+ case fillstruct.Analyzer.Name:
+ arg, err := json.Marshal(CommandRangeArgument{
+ URI: protocol.URIFromSpanURI(d.URI),
+ Range: rng,
+ })
+ if err != nil {
+ return nil, err
}
- for uri, edits := range fix.Edits {
- fh, err := snapshot.GetFile(ctx, uri)
- if err != nil {
- return nil, err
- }
- docChanges := documentChanges(fh, edits)
- action.Edit.DocumentChanges = append(action.Edit.DocumentChanges, docChanges...)
+ action := protocol.CodeAction{
+ Title: d.Message,
+ Kind: protocol.RefactorRewrite,
+ Command: &protocol.Command{
+ Command: source.CommandFillStruct,
+ Title: d.Message,
+ Arguments: []interface{}{
+ string(arg),
+ },
+ },
}
codeActions = append(codeActions, action)
}
+
}
return codeActions, nil
}
diff --git a/internal/lsp/command.go b/internal/lsp/command.go
index 18eee18..8690f65 100644
--- a/internal/lsp/command.go
+++ b/internal/lsp/command.go
@@ -6,6 +6,7 @@
import (
"context"
+ "encoding/json"
"fmt"
"io"
"strings"
@@ -19,6 +20,11 @@
errors "golang.org/x/xerrors"
)
+type CommandRangeArgument struct {
+ URI protocol.DocumentURI `json:"uri,omitempty"`
+ Range protocol.Range `json:"range,omitempty"`
+}
+
func (s *Server) executeCommand(ctx context.Context, params *protocol.ExecuteCommandParams) (interface{}, error) {
var found bool
for _, command := range s.session.Options().SupportedCommands {
@@ -89,6 +95,40 @@
deps := params.Arguments[1].(string)
err := s.directGoModCommand(ctx, uri, "get", strings.Split(deps, " ")...)
return nil, err
+ case source.CommandFillStruct:
+ if len(params.Arguments) != 1 {
+ return nil, fmt.Errorf("expected 1 arguments, got %v: %v", len(params.Arguments), params.Arguments)
+ }
+ var arg CommandRangeArgument
+ str, ok := params.Arguments[0].(string)
+ if !ok {
+ return nil, fmt.Errorf("expected string, got %v (%T)", params.Arguments[0], params.Arguments[0])
+ }
+ if err := json.Unmarshal([]byte(str), &arg); err != nil {
+ return nil, err
+ }
+ snapshot, fh, ok, err := s.beginFileRequest(ctx, arg.URI, source.Go)
+ if !ok {
+ return nil, err
+ }
+ edits, err := source.FillStruct(ctx, snapshot, fh, arg.Range)
+ if err != nil {
+ return nil, err
+ }
+ r, err := s.client.ApplyEdit(ctx, &protocol.ApplyWorkspaceEditParams{
+ Edit: protocol.WorkspaceEdit{
+ DocumentChanges: edits,
+ },
+ })
+ if err != nil {
+ return nil, err
+ }
+ if !r.Applied {
+ return nil, s.client.ShowMessage(ctx, &protocol.ShowMessageParams{
+ Type: protocol.Error,
+ Message: fmt.Sprintf("fillstruct failed: %v", r.FailureReason),
+ })
+ }
}
return nil, nil
}
diff --git a/internal/lsp/fake/client.go b/internal/lsp/fake/client.go
index 4a4c9f2..e053a3d 100644
--- a/internal/lsp/fake/client.go
+++ b/internal/lsp/fake/client.go
@@ -111,7 +111,9 @@
for _, change := range params.Edit.DocumentChanges {
path := c.editor.sandbox.Workdir.URIToPath(change.TextDocument.URI)
edits := convertEdits(change.Edits)
- c.editor.EditBuffer(ctx, path, edits)
+ if err := c.editor.EditBuffer(ctx, path, edits); err != nil {
+ return nil, err
+ }
}
return &protocol.ApplyWorkspaceEditResponse{Applied: true}, nil
}
diff --git a/internal/lsp/fake/editor.go b/internal/lsp/fake/editor.go
index 908cdc1..baea2b2 100644
--- a/internal/lsp/fake/editor.go
+++ b/internal/lsp/fake/editor.go
@@ -595,15 +595,20 @@
// OrganizeImports requests and performs the source.organizeImports codeAction.
func (e *Editor) OrganizeImports(ctx context.Context, path string) error {
- return e.codeAction(ctx, path, nil, protocol.SourceOrganizeImports)
+ return e.codeAction(ctx, path, nil, nil, protocol.SourceOrganizeImports)
+}
+
+// RefactorRewrite requests and performs the source.refactorRewrite codeAction.
+func (e *Editor) RefactorRewrite(ctx context.Context, path string, rng *protocol.Range) error {
+ return e.codeAction(ctx, path, rng, nil, protocol.RefactorRewrite)
}
// ApplyQuickFixes requests and performs the quickfix codeAction.
-func (e *Editor) ApplyQuickFixes(ctx context.Context, path string, diagnostics []protocol.Diagnostic) error {
- return e.codeAction(ctx, path, diagnostics, protocol.QuickFix, protocol.SourceFixAll)
+func (e *Editor) ApplyQuickFixes(ctx context.Context, path string, rng *protocol.Range, diagnostics []protocol.Diagnostic) error {
+ return e.codeAction(ctx, path, rng, diagnostics, protocol.QuickFix, protocol.SourceFixAll)
}
-func (e *Editor) codeAction(ctx context.Context, path string, diagnostics []protocol.Diagnostic, only ...protocol.CodeActionKind) error {
+func (e *Editor) codeAction(ctx context.Context, path string, rng *protocol.Range, diagnostics []protocol.Diagnostic, only ...protocol.CodeActionKind) error {
if e.Server == nil {
return nil
}
@@ -613,12 +618,13 @@
if diagnostics != nil {
params.Context.Diagnostics = diagnostics
}
+ if rng != nil {
+ params.Range = *rng
+ }
actions, err := e.Server.CodeAction(ctx, params)
if err != nil {
return fmt.Errorf("textDocument/codeAction: %w", err)
}
- e.mu.Lock()
- defer e.mu.Unlock()
for _, action := range actions {
var match bool
for _, o := range only {
@@ -637,10 +643,20 @@
continue
}
edits := convertEdits(change.Edits)
- if err := e.editBufferLocked(ctx, path, edits); err != nil {
+ if err := e.EditBuffer(ctx, path, edits); err != nil {
return fmt.Errorf("editing buffer %q: %w", path, err)
}
}
+ // Execute any commands. The specification says that commands are
+ // executed after edits are applied.
+ if action.Command != nil {
+ if _, err := e.Server.ExecuteCommand(ctx, &protocol.ExecuteCommandParams{
+ Command: action.Command.Command,
+ Arguments: action.Command.Arguments,
+ }); err != nil {
+ return err
+ }
+ }
}
return nil
}
@@ -734,7 +750,7 @@
}
// CodeAction executes a codeAction request on the server.
-func (e *Editor) CodeAction(ctx context.Context, path string) ([]protocol.CodeAction, error) {
+func (e *Editor) CodeAction(ctx context.Context, path string, rng *protocol.Range) ([]protocol.CodeAction, error) {
if e.Server == nil {
return nil, nil
}
@@ -747,6 +763,9 @@
params := &protocol.CodeActionParams{
TextDocument: e.textDocumentIdentifier(path),
}
+ if rng != nil {
+ params.Range = *rng
+ }
lens, err := e.Server.CodeAction(ctx, params)
if err != nil {
return nil, err
diff --git a/internal/lsp/lsp_test.go b/internal/lsp/lsp_test.go
index 535bed3..c9c88ce 100644
--- a/internal/lsp/lsp_test.go
+++ b/internal/lsp/lsp_test.go
@@ -414,6 +414,9 @@
if err != nil {
t.Fatalf("CodeAction %s failed: %v", spn, err)
}
+ if actions[0].Command != nil {
+ t.Skip("no tests for code action commands")
+ }
// Hack: We assume that we only get one code action per range.
// TODO(rstambler): Support multiple code actions per test.
if len(actions) == 0 || len(actions) > 1 {
diff --git a/internal/lsp/regtest/fix_test.go b/internal/lsp/regtest/fix_test.go
new file mode 100644
index 0000000..0900baa
--- /dev/null
+++ b/internal/lsp/regtest/fix_test.go
@@ -0,0 +1,68 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package regtest
+
+import (
+ "testing"
+
+ "golang.org/x/tools/internal/lsp"
+ "golang.org/x/tools/internal/lsp/protocol"
+ "golang.org/x/tools/internal/lsp/tests"
+)
+
+// A basic test for fillstruct, now that it uses a command.
+func TestFillStruct(t *testing.T) {
+ const basic = `
+-- go.mod --
+module mod.com
+
+go 1.14
+-- main.go --
+package main
+
+import "go/types"
+
+func Foo() {
+ _ = types.Info{}
+}
+`
+ runner.Run(t, basic, func(t *testing.T, env *Env) {
+ env.Await(
+ CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromInitialWorkspaceLoad), 1),
+ )
+ env.OpenFile("main.go")
+ if err := env.Editor.RefactorRewrite(env.Ctx, "main.go", &protocol.Range{
+ Start: protocol.Position{
+ Line: 5,
+ Character: 16,
+ },
+ End: protocol.Position{
+ Line: 5,
+ Character: 16,
+ },
+ }); err != nil {
+ t.Fatal(err)
+ }
+ want := `package main
+
+import "go/types"
+
+func Foo() {
+ _ = types.Info{
+ Types: map[ast.Expr]types.TypeAndValue{},
+ Defs: map[*ast.Ident]types.Object{},
+ Uses: map[*ast.Ident]types.Object{},
+ Implicits: map[ast.Node]types.Object{},
+ Selections: map[*ast.SelectorExpr]*types.Selection{},
+ Scopes: map[ast.Node]*types.Scope{},
+ InitOrder: []*types.Initializer{},
+ }
+}
+`
+ if got := env.Editor.BufferText("main.go"); got != want {
+ t.Fatalf("TestFillStruct failed:\n%s", tests.Diff(want, got))
+ }
+ })
+}
diff --git a/internal/lsp/regtest/wrappers.go b/internal/lsp/regtest/wrappers.go
index 2f37462..0402b78 100644
--- a/internal/lsp/regtest/wrappers.go
+++ b/internal/lsp/regtest/wrappers.go
@@ -165,7 +165,7 @@
// ApplyQuickFixes processes the quickfix codeAction, calling t.Fatal on any error.
func (e *Env) ApplyQuickFixes(path string, diagnostics []protocol.Diagnostic) {
e.T.Helper()
- if err := e.Editor.ApplyQuickFixes(e.Ctx, path, diagnostics); err != nil {
+ if err := e.Editor.ApplyQuickFixes(e.Ctx, path, nil, diagnostics); err != nil {
e.T.Fatal(err)
}
}
@@ -242,7 +242,7 @@
// t.Fatal if there are errors.
func (e *Env) CodeAction(path string) []protocol.CodeAction {
e.T.Helper()
- actions, err := e.Editor.CodeAction(e.Ctx, path)
+ actions, err := e.Editor.CodeAction(e.Ctx, path, nil)
if err != nil {
e.T.Fatal(err)
}
diff --git a/internal/lsp/source/fill_struct.go b/internal/lsp/source/fill_struct.go
new file mode 100644
index 0000000..5fe3394
--- /dev/null
+++ b/internal/lsp/source/fill_struct.go
@@ -0,0 +1,69 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package source
+
+import (
+ "context"
+ "fmt"
+
+ "golang.org/x/tools/internal/lsp/analysis/fillstruct"
+ "golang.org/x/tools/internal/lsp/protocol"
+ "golang.org/x/tools/internal/span"
+)
+
+func FillStruct(ctx context.Context, snapshot Snapshot, fh FileHandle, pRng protocol.Range) ([]protocol.TextDocumentEdit, error) {
+ pkg, pgh, err := getParsedFile(ctx, snapshot, fh, NarrowestPackageHandle)
+ if err != nil {
+ return nil, fmt.Errorf("getting file for Identifier: %w", err)
+ }
+ file, _, m, _, err := pgh.Cached()
+ if err != nil {
+ return nil, err
+ }
+ spn, err := m.RangeSpan(pRng)
+ if err != nil {
+ return nil, err
+ }
+ rng, err := spn.Range(m.Converter)
+ if err != nil {
+ return nil, err
+ }
+ content, err := fh.Read()
+ if err != nil {
+ return nil, err
+ }
+ fset := snapshot.View().Session().Cache().FileSet()
+ fix, err := fillstruct.SuggestedFix(fset, rng.Start, content, file, pkg.GetTypes(), pkg.GetTypesInfo())
+ if err != nil {
+ return nil, err
+ }
+ var edits []protocol.TextDocumentEdit
+ for _, edit := range fix.TextEdits {
+ rng := span.NewRange(fset, edit.Pos, edit.End)
+ spn, err = rng.Span()
+ if err != nil {
+ return nil, nil
+ }
+ clRng, err := m.Range(spn)
+ if err != nil {
+ return nil, nil
+ }
+ edits = append(edits, protocol.TextDocumentEdit{
+ TextDocument: protocol.VersionedTextDocumentIdentifier{
+ Version: fh.Version(),
+ TextDocumentIdentifier: protocol.TextDocumentIdentifier{
+ URI: protocol.URIFromSpanURI(fh.URI()),
+ },
+ },
+ Edits: []protocol.TextEdit{
+ {
+ Range: clRng,
+ NewText: string(edit.NewText),
+ },
+ },
+ })
+ }
+ return edits, nil
+}
diff --git a/internal/lsp/source/options.go b/internal/lsp/source/options.go
index c59d4d3..e38fa91 100644
--- a/internal/lsp/source/options.go
+++ b/internal/lsp/source/options.go
@@ -72,6 +72,10 @@
// CommandRegenerateCfgo is a gopls command to regenerate cgo definitions.
CommandRegenerateCgo = "regenerate_cgo"
+
+ // CommandFillStruct is a gopls command to fill a struct with default
+ // values.
+ CommandFillStruct = "fill_struct"
)
// DefaultOptions is the options that are used for Gopls execution independent
@@ -104,6 +108,7 @@
},
SupportedCommands: []string{
CommandGenerate,
+ CommandFillStruct,
CommandRegenerateCgo,
CommandTest,
CommandTidy,
@@ -708,7 +713,7 @@
return map[string]Analyzer{
fillstruct.Analyzer.Name: {
Analyzer: fillstruct.Analyzer,
- enabled: false,
+ enabled: true,
},
}
}
diff --git a/internal/lsp/source/source_test.go b/internal/lsp/source/source_test.go
index 9a414e5..4841526 100644
--- a/internal/lsp/source/source_test.go
+++ b/internal/lsp/source/source_test.go
@@ -474,7 +474,60 @@
}
}
-func (r *runner) SuggestedFix(t *testing.T, spn span.Span, actionKinds []string) {}
+func (r *runner) SuggestedFix(t *testing.T, spn span.Span, actionKinds []string) {
+ var refactorRewrite bool
+ for _, actionKind := range actionKinds {
+ if actionKind == "refactor.rewrite" {
+ refactorRewrite = true
+ break
+ }
+ }
+ // Only test refactor rewrite code actions.
+ if !refactorRewrite {
+ return
+ }
+ snapshot := r.view.Snapshot()
+ fh, err := snapshot.GetFile(r.ctx, spn.URI())
+ if err != nil {
+ t.Fatal(err)
+ }
+ edits, err := source.FillStruct(r.ctx, snapshot, fh, protocol.Range{
+ Start: protocol.Position{
+ Line: float64(spn.Start().Line() - 1),
+ Character: float64(spn.Start().Column() - 1),
+ },
+ End: protocol.Position{
+ Line: float64(spn.End().Line() - 1),
+ Character: float64(spn.End().Column() - 1),
+ },
+ })
+ if err != nil {
+ t.Fatal(err)
+ }
+ m, err := r.data.Mapper(fh.URI())
+ if err != nil {
+ t.Fatal(err)
+ }
+ if len(edits) == 0 || len(edits) > 1 {
+ t.Fatalf("expected 1 edit, got %v", len(edits))
+ }
+ diffEdits, err := source.FromProtocolEdits(m, edits[0].Edits)
+ if err != nil {
+ t.Error(err)
+ }
+ data, err := fh.Read()
+ if err != nil {
+ t.Fatal(err)
+ }
+ got := diff.ApplyEdits(string(data), diffEdits)
+ want := string(r.data.Golden("suggestedfix_"+tests.SpanName(spn), fh.URI().Filename(), func() ([]byte, error) {
+ return []byte(got), nil
+ }))
+ if want != got {
+ d := myers.ComputeEdits(spn.URI(), want, got)
+ t.Errorf("import failed for %s: %s", spn.URI().Filename(), diff.ToUnified("want", "got", want, d))
+ }
+}
func (r *runner) FunctionExtraction(t *testing.T, start span.Span, end span.Span) {}
diff --git a/internal/lsp/testdata/lsp/primarymod/fillstruct/a.go b/internal/lsp/testdata/lsp/primarymod/fillstruct/a.go
new file mode 100644
index 0000000..74e681c
--- /dev/null
+++ b/internal/lsp/testdata/lsp/primarymod/fillstruct/a.go
@@ -0,0 +1,98 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
diff --git a/internal/lsp/testdata/lsp/primarymod/fillstruct/a.go.golden b/internal/lsp/testdata/lsp/primarymod/fillstruct/a.go.golden
new file mode 100644
index 0000000..5bf579e
--- /dev/null
+++ b/internal/lsp/testdata/lsp/primarymod/fillstruct/a.go.golden
@@ -0,0 +1,4201 @@
+-- suggestedfix_a_100_30 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type emptyStruct struct{}
+
+var _ = emptyStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{
+ b: new(bool),
+ s: new(string),
+ i: new(int),
+} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_102_25 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{
+ ValuePos: 0,
+ Kind: 0,
+ Value: "",
+}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_103_3 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type emptyStruct struct{}
+
+var _ = emptyStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {
+ ValuePos: 0,
+ Kind: 0,
+ Value: "",
+ }, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_106_25 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type emptyStruct struct{}
+
+var _ = emptyStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{
+ ValuePos: 0,
+ Kind: 0,
+ Value: "",
+}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_18_21 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{
+ foo: 0,
+} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_22_21 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type emptyStruct struct{}
+
+var _ = emptyStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{
+ foo: 0,
+} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_25_22 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{
+ foo: 0,
+ bar: "",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_29_1 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ foo: 0,
+ bar: "",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_29_22 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type emptyStruct struct{}
+
+var _ = emptyStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{
+ foo: 0,
+ bar: "",
+} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_32_22 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{
+ bar: "",
+ basic: basicStruct{},
+} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_33_1 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type emptyStruct struct{}
+
+var _ = emptyStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ foo: 0,
+ bar: "",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_34_16 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{
+ ExportedInt: 0,
+} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_36_22 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{
+ bar: "",
+ basic: basicStruct{},
+} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_38_16 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{
+ ExportedInt: 0,
+} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_40_22 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type emptyStruct struct{}
+
+var _ = emptyStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{
+ bar: "",
+ basic: basicStruct{},
+} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_42_16 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type emptyStruct struct{}
+
+var _ = emptyStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{
+ ExportedInt: 0,
+} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_44_21 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{
+ m: map[string]int{},
+ s: []int{},
+ c: make(chan int),
+ c1: make(<-chan int),
+ a: [2]string{},
+} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_48_21 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{
+ m: map[string]int{},
+ s: []int{},
+ c: make(chan int),
+ c1: make(<-chan int),
+ a: [2]string{},
+} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_50_19 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{
+ fn: func(i int) int {
+ },
+} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_52_21 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type emptyStruct struct{}
+
+var _ = emptyStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{
+ m: map[string]int{},
+ s: []int{},
+ c: make(chan int),
+ c1: make(<-chan int),
+ a: [2]string{},
+} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_54_19 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{
+ fn: func(i int) int {
+ },
+} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_56_25 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{
+ fn: func(i int, s string) (string, int) {
+ },
+} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_58_19 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type emptyStruct struct{}
+
+var _ = emptyStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{
+ fn: func(i int) int {
+ },
+} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_60_25 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{
+ fn: func(i int, s string) (string, int) {
+ },
+} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_62_24 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{
+ fn: func() {
+ },
+} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_64_25 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type emptyStruct struct{}
+
+var _ = emptyStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{
+ fn: func(i int, s string) (string, int) {
+ },
+} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_66_24 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{
+ fn: func() {
+ },
+} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_70_24 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type emptyStruct struct{}
+
+var _ = emptyStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{
+ fn: func() {
+ },
+} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_73_13 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{
+ X: &Foo{},
+ Y: &Foo{},
+} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_77_13 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{
+ X: &Foo{},
+ Y: &Foo{},
+} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_81_13 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type emptyStruct struct{}
+
+var _ = emptyStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{
+ X: &Foo{},
+ Y: &Foo{},
+} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_84_24 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{
+ m: map[*ast.CompositeLit]ast.Field{},
+ s: []ast.BadExpr{},
+ a: [3]token.Token{},
+ c: make(chan ast.EmptyStmt),
+ fn: func(ast_decl ast.DeclStmt) ast.Ellipsis {
+ },
+ st: ast.CompositeLit{},
+} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_88_24 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{
+ m: map[*ast.CompositeLit]ast.Field{},
+ s: []ast.BadExpr{},
+ a: [3]token.Token{},
+ c: make(chan ast.EmptyStmt),
+ fn: func(ast_decl ast.DeclStmt) ast.Ellipsis {
+ },
+ st: ast.CompositeLit{},
+} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_92_24 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type emptyStruct struct{}
+
+var _ = emptyStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{
+ m: map[*ast.CompositeLit]ast.Field{},
+ s: []ast.BadExpr{},
+ a: [3]token.Token{},
+ c: make(chan ast.EmptyStmt),
+ fn: func(ast_decl ast.DeclStmt) ast.Ellipsis {
+ },
+ st: ast.CompositeLit{},
+} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_92_30 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{
+ b: new(bool),
+ s: new(string),
+ i: new(int),
+} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_95_3 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {
+ ValuePos: 0,
+ Kind: 0,
+ Value: "",
+ }, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_96_30 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{
+ b: new(bool),
+ s: new(string),
+ i: new(int),
+} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_98_25 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {}, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{
+ ValuePos: 0,
+ Kind: 0,
+ Value: "",
+}} //@suggestedfix("}", "refactor.rewrite")
+
+-- suggestedfix_a_99_3 --
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fillstruct
+
+import (
+ "go/ast"
+ "go/token"
+
+ "golang.org/x/tools/internal/lsp/fillstruct/data"
+)
+
+type basicStruct struct {
+ foo int
+}
+
+var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type twoArgStruct struct {
+ foo int
+ bar string
+}
+
+var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = twoArgStruct{
+ bar: "bar",
+} //@suggestedfix("}", "refactor.rewrite")
+
+type nestedStruct struct {
+ bar string
+ basic basicStruct
+}
+
+var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = data.B{} //@suggestedfix("}", "refactor.rewrite")
+
+type typedStruct struct {
+ m map[string]int
+ s []int
+ c chan int
+ c1 <-chan int
+ a [2]string
+}
+
+var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStruct struct {
+ fn func(i int) int
+}
+
+var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructCompex struct {
+ fn func(i int, s string) (string, int)
+}
+
+var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite")
+
+type funStructEmpty struct {
+ fn func()
+}
+
+var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite")
+
+type Foo struct {
+ A int
+}
+
+type Bar struct {
+ X *Foo
+ Y *Foo
+}
+
+var _ = Bar{} //@suggestedfix("}", "refactor.rewrite")
+
+type importedStruct struct {
+ m map[*ast.CompositeLit]ast.Field
+ s []ast.BadExpr
+ a [3]token.Token
+ c chan ast.EmptyStmt
+ fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+ st ast.CompositeLit
+}
+
+var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+type pointerBuiltinStruct struct {
+ b *bool
+ s *string
+ i *int
+}
+
+var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite")
+
+var _ = []ast.BasicLit{
+ {
+ ValuePos: 0,
+ Kind: 0,
+ Value: "",
+ }, //@suggestedfix("}", "refactor.rewrite")
+}
+
+var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite")
+
diff --git a/internal/lsp/testdata/lsp/primarymod/fillstruct/data/a.go b/internal/lsp/testdata/lsp/primarymod/fillstruct/data/a.go
index 2860da9..7ca3773 100644
--- a/internal/lsp/testdata/lsp/primarymod/fillstruct/data/a.go
+++ b/internal/lsp/testdata/lsp/primarymod/fillstruct/data/a.go
@@ -1,6 +1,6 @@
package data
-type A struct {
+type B struct {
ExportedInt int
unexportedInt int
}
diff --git a/internal/lsp/testdata/lsp/primarymod/fillstruct/fill_struct_package.go b/internal/lsp/testdata/lsp/primarymod/fillstruct/fill_struct_package.go
index a2375c4..71f1248 100644
--- a/internal/lsp/testdata/lsp/primarymod/fillstruct/fill_struct_package.go
+++ b/internal/lsp/testdata/lsp/primarymod/fillstruct/fill_struct_package.go
@@ -7,6 +7,6 @@
)
func unexported() {
- a := data.A{} //@suggestedfix("}", "refactor.rewrite")
+ a := data.B{} //@suggestedfix("}", "refactor.rewrite")
_ = h2.Client{} //@suggestedfix("}", "refactor.rewrite")
}
diff --git a/internal/lsp/testdata/lsp/primarymod/fillstruct/fill_struct_package.go.golden b/internal/lsp/testdata/lsp/primarymod/fillstruct/fill_struct_package.go.golden
index a72afbd..13c8570 100644
--- a/internal/lsp/testdata/lsp/primarymod/fillstruct/fill_struct_package.go.golden
+++ b/internal/lsp/testdata/lsp/primarymod/fillstruct/fill_struct_package.go.golden
@@ -8,7 +8,7 @@
)
func unexported() {
- a := data.A{
+ a := data.B{
ExportedInt: 0,
} //@suggestedfix("}", "refactor.rewrite")
_ = h2.Client{} //@suggestedfix("}", "refactor.rewrite")
@@ -24,7 +24,7 @@
)
func unexported() {
- a := data.A{} //@suggestedfix("}", "refactor.rewrite")
+ a := data.B{} //@suggestedfix("}", "refactor.rewrite")
_ = h2.Client{
Transport: nil,
CheckRedirect: func(req *h2.Request, via []*h2.Request) error {
diff --git a/internal/lsp/testdata/lsp/summary.txt.golden b/internal/lsp/testdata/lsp/summary.txt.golden
index 8fdb792..2009987 100644
--- a/internal/lsp/testdata/lsp/summary.txt.golden
+++ b/internal/lsp/testdata/lsp/summary.txt.golden
@@ -11,7 +11,7 @@
FoldingRangesCount = 2
FormatCount = 6
ImportCount = 8
-SuggestedFixCount = 18
+SuggestedFixCount = 31
FunctionExtractionCount = 5
DefinitionsCount = 53
TypeDefinitionsCount = 2