gopls/internal/golang: s/Show/View/ for web-based reports All three should be consistent, and "View" connotes a separate surface more than "Show", which connotes adding annotations to the current editor view. Also, rephrase assembly template to encourage upvoting of the relevant VS Code issue. Change-Id: I99b07ba347e2023bd672e2b34b13faeece4108db Reviewed-on: https://go-review.googlesource.com/c/tools/+/591915 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
diff --git a/gopls/doc/commands.md b/gopls/doc/commands.md index 66614ce..311f4a5 100644 --- a/gopls/doc/commands.md +++ b/gopls/doc/commands.md
@@ -140,7 +140,7 @@ } ``` -## `gopls.assembly`: **Show disassembly of current function.** +## `gopls.assembly`: **View assembly listing of current function in a browser.** This command opens a web-based disassembly listing of the specified function symbol (plus any nested lambdas and defers). @@ -310,7 +310,7 @@ map[golang.org/x/tools/gopls/internal/protocol.DocumentURI]*golang.org/x/tools/gopls/internal/vulncheck.Result ``` -## `gopls.free_symbols`: **report free symbols referenced by the selection.** +## `gopls.free_symbols`: **View free symbols referenced by the selection in a browser.** This command is a query over a selected range of Go source code. It reports the set of "free" symbols of the
diff --git a/gopls/doc/release/v0.16.0.md b/gopls/doc/release/v0.16.0.md index ab54ae2..da18a2d 100644 --- a/gopls/doc/release/v0.16.0.md +++ b/gopls/doc/release/v0.16.0.md
@@ -50,9 +50,9 @@ - TODO: test in vim, neovim, sublime, helix. -### Free symbols +### View free symbols -Gopls offers another web-based code action, "Show free symbols", +Gopls offers another web-based code action, "View free symbols", which displays the free symbols referenced by the selected code. A symbol is "free" if it is referenced within the selection but @@ -88,9 +88,9 @@ ``` TODO(dominikh/go-mode.el#436): add both of these to go-mode.el. -### Show assembly +### View assembly -Gopls offers a third web-based code action, "Show assembly for f", +Gopls offers a third web-based code action, "View assembly for f", which displays an assembly listing of the function declaration enclosing the selected code, plus any nested functions (function literals, deferred calls).
diff --git a/gopls/internal/doc/api.json b/gopls/internal/doc/api.json index a977633..8ad8ca8 100644 --- a/gopls/internal/doc/api.json +++ b/gopls/internal/doc/api.json
@@ -962,7 +962,7 @@ }, { "Command": "gopls.assembly", - "Title": "Show disassembly of current function.", + "Title": "View assembly listing of current function in a browser.", "Doc": "This command opens a web-based disassembly listing of the\nspecified function symbol (plus any nested lambdas and defers).\nThe machine architecture is determined by the view.", "ArgDoc": "string,\nstring,\nstring", "ResultDoc": "" @@ -1011,7 +1011,7 @@ }, { "Command": "gopls.free_symbols", - "Title": "report free symbols referenced by the selection.", + "Title": "View free symbols referenced by the selection in a browser.", "Doc": "This command is a query over a selected range of Go source\ncode. It reports the set of \"free\" symbols of the\nselection: the set of symbols that are referenced within\nthe selection but are declared outside of it. This\ninformation is useful for understanding at a glance what a\nblock of code depends on, perhaps as a precursor to\nextracting it into a separate function.", "ArgDoc": "string,\n{\n\t\"uri\": string,\n\t\"range\": {\n\t\t\"start\": {\n\t\t\t\"line\": uint32,\n\t\t\t\"character\": uint32,\n\t\t},\n\t\t\"end\": {\n\t\t\t\"line\": uint32,\n\t\t\t\"character\": uint32,\n\t\t},\n\t},\n}", "ResultDoc": ""
diff --git a/gopls/internal/golang/assembly.go b/gopls/internal/golang/assembly.go index dc5b589..7defd41 100644 --- a/gopls/internal/golang/assembly.go +++ b/gopls/internal/golang/assembly.go
@@ -4,7 +4,7 @@ package golang -// This file produces the "Show GOARCH assembly of f" HTML report. +// This file produces the "View GOARCH assembly of f" HTML report. // // See also: // - ./codeaction.go - computes the symbol and offers the CodeAction command. @@ -72,7 +72,7 @@ </p> <p> Click on a source line marker <code>L1234</code> to navigate your editor there. - (Beware: <a href='https://github.com/microsoft/vscode/issues/207634'>#207634</a>) + (VS Code users: please upvote <a href='https://github.com/microsoft/vscode/issues/208093'>#208093</a>) </p> <p> Reload the page to recompile.
diff --git a/gopls/internal/golang/codeaction.go b/gopls/internal/golang/codeaction.go index 1aeecdd..415ad37 100644 --- a/gopls/internal/golang/codeaction.go +++ b/gopls/internal/golang/codeaction.go
@@ -118,7 +118,7 @@ if want[protocol.GoFreeSymbols] && rng.End != rng.Start { loc := protocol.Location{URI: pgf.URI, Range: rng} - cmd, err := command.NewFreeSymbolsCommand("Show free symbols", snapshot.View().ID(), loc) + cmd, err := command.NewFreeSymbolsCommand("View free symbols", snapshot.View().ID(), loc) if err != nil { return nil, err } @@ -535,7 +535,7 @@ }}, nil } -// getGoAssemblyAction returns any "Show assembly for f" code actions for the selection. +// getGoAssemblyAction returns any "View assembly for f" code actions for the selection. func getGoAssemblyAction(view *cache.View, pkg *cache.Package, pgf *parsego.File, rng protocol.Range) ([]protocol.CodeAction, error) { start, end, err := pgf.RangePos(rng) if err != nil { @@ -593,7 +593,7 @@ (fn.Name() != "init" || sig.Recv() != nil) && // init functions aren't linker functions sig.TypeParams() == nil && sig.RecvTypeParams() == nil { // generic => no assembly cmd, err := command.NewAssemblyCommand( - fmt.Sprintf("Show %s assembly for %s", view.GOARCH(), decl.Name), + fmt.Sprintf("View %s assembly for %s", view.GOARCH(), decl.Name), view.ID(), string(pkg.Metadata().ID), sym.String())
diff --git a/gopls/internal/golang/freesymbols.go b/gopls/internal/golang/freesymbols.go index 6a71c20..c203703 100644 --- a/gopls/internal/golang/freesymbols.go +++ b/gopls/internal/golang/freesymbols.go
@@ -4,7 +4,7 @@ package golang -// This file implements the "Show free symbols" code action. +// This file implements the "View free symbols" code action. import ( "bytes"
diff --git a/gopls/internal/protocol/command/interface.go b/gopls/internal/protocol/command/interface.go index 6e0e268..7694157 100644 --- a/gopls/internal/protocol/command/interface.go +++ b/gopls/internal/protocol/command/interface.go
@@ -242,7 +242,7 @@ // This command is intended for use by gopls tests only. Views(context.Context) ([]View, error) - // FreeSymbols: report free symbols referenced by the selection. + // FreeSymbols: View free symbols referenced by the selection in a browser. // // This command is a query over a selected range of Go source // code. It reports the set of "free" symbols of the @@ -253,7 +253,7 @@ // extracting it into a separate function. FreeSymbols(ctx context.Context, viewID string, loc protocol.Location) error - // Assembly: Show disassembly of current function. + // Assembly: View assembly listing of current function in a browser. // // This command opens a web-based disassembly listing of the // specified function symbol (plus any nested lambdas and defers).
diff --git a/gopls/internal/test/integration/misc/webserver_test.go b/gopls/internal/test/integration/misc/webserver_test.go index 0a692ec..e579555 100644 --- a/gopls/internal/test/integration/misc/webserver_test.go +++ b/gopls/internal/test/integration/misc/webserver_test.go
@@ -253,7 +253,7 @@ Run(t, files, func(t *testing.T, env *Env) { env.OpenFile("a/a.go") - // Invoke the "Show free symbols" code + // Invoke the "View free symbols" code // action to start the server. loc := env.RegexpSearch("a/a.go", "«((?:.|\n)*)»") actions, err := env.Editor.CodeAction(env.Ctx, loc, nil, protocol.CodeActionUnknownTrigger) @@ -262,13 +262,13 @@ } var action *protocol.CodeAction for _, a := range actions { - if a.Title == "Show free symbols" { + if a.Title == "View free symbols" { action = &a break } } if action == nil { - t.Fatalf("can't find action with Title 'Show free symbols', only %#v", + t.Fatalf("can't find action with Title 'View free symbols', only %#v", actions) } @@ -320,13 +320,13 @@ Run(t, files, func(t *testing.T, env *Env) { env.OpenFile("a/a.go") - // Invoke the "Show assembly" code action to start the server. + // Invoke the "View assembly" code action to start the server. loc := env.RegexpSearch("a/a.go", "println") actions, err := env.Editor.CodeAction(env.Ctx, loc, nil, protocol.CodeActionUnknownTrigger) if err != nil { t.Fatalf("CodeAction: %v", err) } - const wantTitle = "Show " + runtime.GOARCH + " assembly for f" + const wantTitle = "View " + runtime.GOARCH + " assembly for f" var action *protocol.CodeAction for _, a := range actions { if a.Title == wantTitle {