From 51f72a196fcd82a646f7fca4d2ec05ca42272c39 Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Tue, 9 Feb 2021 22:53:49 -0500 Subject: [PATCH] internal/lsp: address Rob's comments from CL 289772 Change-Id: Ifc5431b2e549c5221d66f7771dac47fcb70afb56 Reviewed-on: https://go-review.googlesource.com/c/tools/+/290829 Trust: Rebecca Stambler Run-TryBot: Rebecca Stambler gopls-CI: kokoro TryBot-Result: Go Bot Reviewed-by: Robert Findley --- gopls/doc/commands.md | 4 ++-- gopls/internal/regtest/workspace/workspace_test.go | 2 +- gopls/internal/regtest/wrappers.go | 6 ------ internal/lsp/command/interface.go | 2 +- internal/lsp/source/api_json.go | 4 ++-- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/gopls/doc/commands.md b/gopls/doc/commands.md index 8c5a06d26f..ab77bbe256 100644 --- a/gopls/doc/commands.md +++ b/gopls/doc/commands.md @@ -193,7 +193,7 @@ Args: ``` { - // The file URI. + // The file URIs. "URIs": []string, } ``` @@ -221,7 +221,7 @@ Args: ``` { - // The file URI. + // The file URIs. "URIs": []string, } ``` diff --git a/gopls/internal/regtest/workspace/workspace_test.go b/gopls/internal/regtest/workspace/workspace_test.go index f3f1a77a93..8712784626 100644 --- a/gopls/internal/regtest/workspace/workspace_test.go +++ b/gopls/internal/regtest/workspace/workspace_test.go @@ -826,7 +826,7 @@ func main() { if d.Message != `go.sum is out of sync with go.mod. Please update it by applying the quick fix.` { continue } - actions, err := env.GetQuickFixes("a/go.mod", []protocol.Diagnostic{d}) + actions, err := env.Editor.GetQuickFixes(env.Ctx, "a/go.mod", nil, []protocol.Diagnostic{d}) if err != nil { t.Fatal(err) } diff --git a/gopls/internal/regtest/wrappers.go b/gopls/internal/regtest/wrappers.go index 12ac7f9746..fa9367e129 100644 --- a/gopls/internal/regtest/wrappers.go +++ b/gopls/internal/regtest/wrappers.go @@ -200,12 +200,6 @@ func (e *Env) ApplyQuickFixes(path string, diagnostics []protocol.Diagnostic) { } } -// GetQuickFixes returns the available quick fix code actions. -func (e *Env) GetQuickFixes(path string, diagnostics []protocol.Diagnostic) ([]protocol.CodeAction, error) { - e.T.Helper() - return e.Editor.GetQuickFixes(e.Ctx, path, nil, diagnostics) -} - // Hover in the editor, calling t.Fatal on any error. func (e *Env) Hover(name string, pos fake.Pos) (*protocol.MarkupContent, fake.Pos) { e.T.Helper() diff --git a/internal/lsp/command/interface.go b/internal/lsp/command/interface.go index 3d258a8638..1fd7fc56eb 100644 --- a/internal/lsp/command/interface.go +++ b/internal/lsp/command/interface.go @@ -152,7 +152,7 @@ type URIArg struct { } type URIArgs struct { - // The file URI. + // The file URIs. URIs []protocol.DocumentURI } diff --git a/internal/lsp/source/api_json.go b/internal/lsp/source/api_json.go index 1942cf3f29..83b3b34888 100755 --- a/internal/lsp/source/api_json.go +++ b/internal/lsp/source/api_json.go @@ -742,7 +742,7 @@ var GeneratedAPIJSON = &APIJSON{ Command: "gopls.tidy", Title: "Run go mod tidy", Doc: "Runs `go mod tidy` for a module.", - ArgDoc: "{\n\t// The file URI.\n\t\"URIs\": []string,\n}", + ArgDoc: "{\n\t// The file URIs.\n\t\"URIs\": []string,\n}", }, { Command: "gopls.toggle_gc_details", @@ -754,7 +754,7 @@ var GeneratedAPIJSON = &APIJSON{ Command: "gopls.update_go_sum", Title: "Update go.sum", Doc: "Updates the go.sum file for a module.", - ArgDoc: "{\n\t// The file URI.\n\t\"URIs\": []string,\n}", + ArgDoc: "{\n\t// The file URIs.\n\t\"URIs\": []string,\n}", }, { Command: "gopls.upgrade_dependency",