gopls/internal/golang: s/View/Browse/ for browser-based features
We decided "browse" is better than "view" (or last week's "show")
for the UI description, since it connotes "web browser".
Thanks to Dominik Honnef for the idea.
Updates golang/go#67949
Change-Id: If32be800e5c2a0fc50028aad88a00467abe10421
Reviewed-on: https://go-review.googlesource.com/c/tools/+/592496
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/gopls/doc/commands.md b/gopls/doc/commands.md
index b29d656..7488e1f 100644
--- a/gopls/doc/commands.md
+++ b/gopls/doc/commands.md
@@ -140,7 +140,7 @@
}
```
-## `gopls.assembly`: **View assembly listing of current function in a browser.**
+## `gopls.assembly`: **Browse 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).
@@ -253,7 +253,7 @@
}
```
-## `gopls.doc`: **View package documentation.**
+## `gopls.doc`: **Browse package documentation.**
Opens the Go package documentation page for the current
package in a browser.
@@ -310,7 +310,7 @@
map[golang.org/x/tools/gopls/internal/protocol.DocumentURI]*golang.org/x/tools/gopls/internal/vulncheck.Result
```
-## `gopls.free_symbols`: **View free symbols referenced by the selection in a browser.**
+## `gopls.free_symbols`: **Browse 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 4cf2356..dcb6005 100644
--- a/gopls/doc/release/v0.16.0.md
+++ b/gopls/doc/release/v0.16.0.md
@@ -71,7 +71,7 @@
### Integrated documentation viewer
-Gopls now offers a "View package documentation" code action that opens
+Gopls now offers a "Browse package documentation" code action that opens
a local web page displaying the generated documentation for the
current Go package in a form similar to https://pkg.go.dev.
The page will be initially scrolled to the documentation for the
@@ -90,7 +90,7 @@
Editor support:
-- VS Code: use the `Source action > View package documentation` menu item.
+- VS Code: use the `Source action > Browse package documentation` menu item.
Note: source links navigate the editor but don't yet raise the window yet.
Please upvote https://github.com/microsoft/vscode/issues/208093 and
https://github.com/microsoft/vscode/issues/207634 (temporarily closed).
@@ -102,14 +102,14 @@
(eglot--code-action eglot-code-action-doc "source.doc")
(defalias 'go-doc #'eglot-code-action-doc
- "View documentation for the current Go package.")
+ "Browse documentation for the current Go package.")
```
- TODO: test in vim, neovim, sublime, helix.
-### View free symbols
+### Browse free symbols
-Gopls offers another web-based code action, "View free symbols",
+Gopls offers another web-based code action, "Browse free symbols",
which displays the free symbols referenced by the selected code.
A symbol is "free" if it is referenced within the selection but
@@ -125,14 +125,14 @@
as a separate item, so that you can see which parts of a complex
type are actually needed.
-Viewing the free symbols of the body of a function may reveal that
+The free symbols of the body of a function may reveal that
only a small part (a single field of a struct, say) of one of the
function's parameters is used, allowing you to simplify and generalize
the function by choosing a different type for that parameter.
- TODO screenshot
-- VS Code: use the `Source action > View free symbols` menu item.
+- VS Code: use the `Source action > Browse free symbols` menu item.
- Emacs: requires eglot v1.17. You may find this `go-doc` function a
useful shortcut:
@@ -141,13 +141,13 @@
(eglot--code-action eglot-code-action-freesymbols "source.freesymbols")
(defalias 'go-freesymbols #'eglot-code-action-freesymbols
- "View free symbols referred to by the current selection.")
+ "Browse free symbols referred to by the current selection.")
```
TODO(dominikh/go-mode.el#436): add both of these to go-mode.el.
-### View assembly
+### Browse assembly
-Gopls offers a third web-based code action, "View assembly for f",
+Gopls offers a third web-based code action, "Browse 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 c8cd83d..a789483 100644
--- a/gopls/internal/doc/api.json
+++ b/gopls/internal/doc/api.json
@@ -962,7 +962,7 @@
},
{
"Command": "gopls.assembly",
- "Title": "View assembly listing of current function in a browser.",
+ "Title": "Browse 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": ""
@@ -990,7 +990,7 @@
},
{
"Command": "gopls.doc",
- "Title": "View package documentation.",
+ "Title": "Browse package documentation.",
"Doc": "Opens the Go package documentation page for the current\npackage in a browser.",
"ArgDoc": "{\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": ""
@@ -1011,7 +1011,7 @@
},
{
"Command": "gopls.free_symbols",
- "Title": "View free symbols referenced by the selection in a browser.",
+ "Title": "Browse 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 7defd41..63d8e82 100644
--- a/gopls/internal/golang/assembly.go
+++ b/gopls/internal/golang/assembly.go
@@ -4,7 +4,7 @@
package golang
-// This file produces the "View GOARCH assembly of f" HTML report.
+// This file produces the "Browse GOARCH assembly of f" HTML report.
//
// See also:
// - ./codeaction.go - computes the symbol and offers the CodeAction command.
diff --git a/gopls/internal/golang/codeaction.go b/gopls/internal/golang/codeaction.go
index 415ad37..ee62bac 100644
--- a/gopls/internal/golang/codeaction.go
+++ b/gopls/internal/golang/codeaction.go
@@ -105,7 +105,7 @@
if want[protocol.GoDoc] {
loc := protocol.Location{URI: pgf.URI, Range: rng}
- cmd, err := command.NewDocCommand("View package documentation", loc)
+ cmd, err := command.NewDocCommand("Browse package documentation", loc)
if err != nil {
return nil, err
}
@@ -118,7 +118,7 @@
if want[protocol.GoFreeSymbols] && rng.End != rng.Start {
loc := protocol.Location{URI: pgf.URI, Range: rng}
- cmd, err := command.NewFreeSymbolsCommand("View free symbols", snapshot.View().ID(), loc)
+ cmd, err := command.NewFreeSymbolsCommand("Browse free symbols", snapshot.View().ID(), loc)
if err != nil {
return nil, err
}
@@ -535,7 +535,7 @@
}}, nil
}
-// getGoAssemblyAction returns any "View assembly for f" code actions for the selection.
+// getGoAssemblyAction returns any "Browse 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("View %s assembly for %s", view.GOARCH(), decl.Name),
+ fmt.Sprintf("Browse %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 c203703..edf6938 100644
--- a/gopls/internal/golang/freesymbols.go
+++ b/gopls/internal/golang/freesymbols.go
@@ -4,7 +4,7 @@
package golang
-// This file implements the "View free symbols" code action.
+// This file implements the "Browse free symbols" code action.
import (
"bytes"
@@ -259,7 +259,7 @@
as a separate item, so that you can see which parts of a complex
type are actually needed.
- Viewing the free symbols referenced by the body of a function may
+ The free symbols referenced by the body of a function may
reveal that only a small part (a single field of a struct, say) of
one of the function's parameters is used, allowing you to simplify
and generalize the function by choosing a different type for that
diff --git a/gopls/internal/protocol/command/interface.go b/gopls/internal/protocol/command/interface.go
index 80052af..54694c0 100644
--- a/gopls/internal/protocol/command/interface.go
+++ b/gopls/internal/protocol/command/interface.go
@@ -69,7 +69,7 @@
// Runs `go generate` for a given directory.
Generate(context.Context, GenerateArgs) error
- // Doc: View package documentation.
+ // Doc: Browse package documentation.
//
// Opens the Go package documentation page for the current
// package in a browser.
@@ -242,7 +242,7 @@
// This command is intended for use by gopls tests only.
Views(context.Context) ([]View, error)
- // FreeSymbols: View free symbols referenced by the selection in a browser.
+ // FreeSymbols: Browse 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: View assembly listing of current function in a browser.
+ // Assembly: Browse 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 c015960..daa9cd6 100644
--- a/gopls/internal/test/integration/misc/webserver_test.go
+++ b/gopls/internal/test/integration/misc/webserver_test.go
@@ -20,7 +20,7 @@
)
// TestWebServer exercises the web server created on demand
-// for code actions such as "View package documentation".
+// for code actions such as "Browse package documentation".
func TestWebServer(t *testing.T) {
const files = `
-- go.mod --
@@ -191,24 +191,24 @@
})
}
-// viewPkgDoc invokes the "View package documentation" code action in
+// viewPkgDoc invokes the "Browse package documentation" code action in
// the specified file. It returns the URI of the document, or fails
// the test.
func viewPkgDoc(t *testing.T, env *Env, filename string) protocol.URI {
env.OpenFile(filename)
- // Invoke the "View package documentation" code
+ // Invoke the "Browse package documentation" code
// action to start the server.
var docAction *protocol.CodeAction
actions := env.CodeActionForFile(filename, nil)
for _, act := range actions {
- if act.Title == "View package documentation" {
+ if act.Title == "Browse package documentation" {
docAction = &act
break
}
}
if docAction == nil {
- t.Fatalf("can't find action with Title 'View package documentation', only %#v",
+ t.Fatalf("can't find action with Title 'Browse package documentation', only %#v",
actions)
}
@@ -253,7 +253,7 @@
Run(t, files, func(t *testing.T, env *Env) {
env.OpenFile("a/a.go")
- // Invoke the "View free symbols" code
+ // Invoke the "Browse 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 == "View free symbols" {
+ if a.Title == "Browse free symbols" {
action = &a
break
}
}
if action == nil {
- t.Fatalf("can't find action with Title 'View free symbols', only %#v",
+ t.Fatalf("can't find action with Title 'Browse 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 "View assembly" code action to start the server.
+ // Invoke the "Browse 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 = "View " + runtime.GOARCH + " assembly for f"
+ const wantTitle = "Browse " + runtime.GOARCH + " assembly for f"
var action *protocol.CodeAction
for _, a := range actions {
if a.Title == wantTitle {