Skip to content

Commit b5dbe8b

Browse files
adonovangopherbot
authored andcommitted
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 <[email protected]> Auto-Submit: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 2ca6abe commit b5dbe8b

File tree

8 files changed

+36
-36
lines changed

8 files changed

+36
-36
lines changed

gopls/doc/commands.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Result:
140140
}
141141
```
142142

143-
## `gopls.assembly`: **View assembly listing of current function in a browser.**
143+
## `gopls.assembly`: **Browse assembly listing of current function in a browser.**
144144

145145
This command opens a web-based disassembly listing of the
146146
specified function symbol (plus any nested lambdas and defers).
@@ -253,7 +253,7 @@ Args:
253253
}
254254
```
255255

256-
## `gopls.doc`: **View package documentation.**
256+
## `gopls.doc`: **Browse package documentation.**
257257

258258
Opens the Go package documentation page for the current
259259
package in a browser.
@@ -310,7 +310,7 @@ Result:
310310
map[golang.org/x/tools/gopls/internal/protocol.DocumentURI]*golang.org/x/tools/gopls/internal/vulncheck.Result
311311
```
312312

313-
## `gopls.free_symbols`: **View free symbols referenced by the selection in a browser.**
313+
## `gopls.free_symbols`: **Browse free symbols referenced by the selection in a browser.**
314314

315315
This command is a query over a selected range of Go source
316316
code. It reports the set of "free" symbols of the

gopls/doc/release/v0.16.0.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ in go.mod files.
7171

7272
### Integrated documentation viewer
7373

74-
Gopls now offers a "View package documentation" code action that opens
74+
Gopls now offers a "Browse package documentation" code action that opens
7575
a local web page displaying the generated documentation for the
7676
current Go package in a form similar to https://pkg.go.dev.
7777
The page will be initially scrolled to the documentation for the
@@ -90,7 +90,7 @@ TODO: demo of source linking.
9090

9191
Editor support:
9292

93-
- VS Code: use the `Source action > View package documentation` menu item.
93+
- VS Code: use the `Source action > Browse package documentation` menu item.
9494
Note: source links navigate the editor but don't yet raise the window yet.
9595
Please upvote https://github.com/microsoft/vscode/issues/208093 and
9696
https://github.com/microsoft/vscode/issues/207634 (temporarily closed).
@@ -102,14 +102,14 @@ Editor support:
102102
(eglot--code-action eglot-code-action-doc "source.doc")
103103
104104
(defalias 'go-doc #'eglot-code-action-doc
105-
"View documentation for the current Go package.")
105+
"Browse documentation for the current Go package.")
106106
```
107107

108108
- TODO: test in vim, neovim, sublime, helix.
109109

110-
### View free symbols
110+
### Browse free symbols
111111

112-
Gopls offers another web-based code action, "View free symbols",
112+
Gopls offers another web-based code action, "Browse free symbols",
113113
which displays the free symbols referenced by the selected code.
114114

115115
A symbol is "free" if it is referenced within the selection but
@@ -125,14 +125,14 @@ Each dotted path of identifiers (such as `file.Name.Pos`) is reported
125125
as a separate item, so that you can see which parts of a complex
126126
type are actually needed.
127127

128-
Viewing the free symbols of the body of a function may reveal that
128+
The free symbols of the body of a function may reveal that
129129
only a small part (a single field of a struct, say) of one of the
130130
function's parameters is used, allowing you to simplify and generalize
131131
the function by choosing a different type for that parameter.
132132

133133
- TODO screenshot
134134

135-
- VS Code: use the `Source action > View free symbols` menu item.
135+
- VS Code: use the `Source action > Browse free symbols` menu item.
136136

137137
- Emacs: requires eglot v1.17. You may find this `go-doc` function a
138138
useful shortcut:
@@ -141,13 +141,13 @@ the function by choosing a different type for that parameter.
141141
(eglot--code-action eglot-code-action-freesymbols "source.freesymbols")
142142
143143
(defalias 'go-freesymbols #'eglot-code-action-freesymbols
144-
"View free symbols referred to by the current selection.")
144+
"Browse free symbols referred to by the current selection.")
145145
```
146146
TODO(dominikh/go-mode.el#436): add both of these to go-mode.el.
147147

148-
### View assembly
148+
### Browse assembly
149149

150-
Gopls offers a third web-based code action, "View assembly for f",
150+
Gopls offers a third web-based code action, "Browse assembly for f",
151151
which displays an assembly listing of the function declaration
152152
enclosing the selected code, plus any nested functions (function
153153
literals, deferred calls).

gopls/internal/doc/api.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@
962962
},
963963
{
964964
"Command": "gopls.assembly",
965-
"Title": "View assembly listing of current function in a browser.",
965+
"Title": "Browse assembly listing of current function in a browser.",
966966
"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.",
967967
"ArgDoc": "string,\nstring,\nstring",
968968
"ResultDoc": ""
@@ -990,7 +990,7 @@
990990
},
991991
{
992992
"Command": "gopls.doc",
993-
"Title": "View package documentation.",
993+
"Title": "Browse package documentation.",
994994
"Doc": "Opens the Go package documentation page for the current\npackage in a browser.",
995995
"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}",
996996
"ResultDoc": ""
@@ -1011,7 +1011,7 @@
10111011
},
10121012
{
10131013
"Command": "gopls.free_symbols",
1014-
"Title": "View free symbols referenced by the selection in a browser.",
1014+
"Title": "Browse free symbols referenced by the selection in a browser.",
10151015
"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.",
10161016
"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}",
10171017
"ResultDoc": ""

gopls/internal/golang/assembly.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
package golang
66

7-
// This file produces the "View GOARCH assembly of f" HTML report.
7+
// This file produces the "Browse GOARCH assembly of f" HTML report.
88
//
99
// See also:
1010
// - ./codeaction.go - computes the symbol and offers the CodeAction command.

gopls/internal/golang/codeaction.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func CodeActions(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle,
105105

106106
if want[protocol.GoDoc] {
107107
loc := protocol.Location{URI: pgf.URI, Range: rng}
108-
cmd, err := command.NewDocCommand("View package documentation", loc)
108+
cmd, err := command.NewDocCommand("Browse package documentation", loc)
109109
if err != nil {
110110
return nil, err
111111
}
@@ -118,7 +118,7 @@ func CodeActions(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle,
118118

119119
if want[protocol.GoFreeSymbols] && rng.End != rng.Start {
120120
loc := protocol.Location{URI: pgf.URI, Range: rng}
121-
cmd, err := command.NewFreeSymbolsCommand("View free symbols", snapshot.View().ID(), loc)
121+
cmd, err := command.NewFreeSymbolsCommand("Browse free symbols", snapshot.View().ID(), loc)
122122
if err != nil {
123123
return nil, err
124124
}
@@ -535,7 +535,7 @@ func getGoTestCodeActions(pkg *cache.Package, pgf *parsego.File, rng protocol.Ra
535535
}}, nil
536536
}
537537

538-
// getGoAssemblyAction returns any "View assembly for f" code actions for the selection.
538+
// getGoAssemblyAction returns any "Browse assembly for f" code actions for the selection.
539539
func getGoAssemblyAction(view *cache.View, pkg *cache.Package, pgf *parsego.File, rng protocol.Range) ([]protocol.CodeAction, error) {
540540
start, end, err := pgf.RangePos(rng)
541541
if err != nil {
@@ -593,7 +593,7 @@ func getGoAssemblyAction(view *cache.View, pkg *cache.Package, pgf *parsego.File
593593
(fn.Name() != "init" || sig.Recv() != nil) && // init functions aren't linker functions
594594
sig.TypeParams() == nil && sig.RecvTypeParams() == nil { // generic => no assembly
595595
cmd, err := command.NewAssemblyCommand(
596-
fmt.Sprintf("View %s assembly for %s", view.GOARCH(), decl.Name),
596+
fmt.Sprintf("Browse %s assembly for %s", view.GOARCH(), decl.Name),
597597
view.ID(),
598598
string(pkg.Metadata().ID),
599599
sym.String())

gopls/internal/golang/freesymbols.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
package golang
66

7-
// This file implements the "View free symbols" code action.
7+
// This file implements the "Browse free symbols" code action.
88

99
import (
1010
"bytes"
@@ -259,7 +259,7 @@ p { max-width: 6in; }
259259
as a separate item, so that you can see which parts of a complex
260260
type are actually needed.
261261
262-
Viewing the free symbols referenced by the body of a function may
262+
The free symbols referenced by the body of a function may
263263
reveal that only a small part (a single field of a struct, say) of
264264
one of the function's parameters is used, allowing you to simplify
265265
and generalize the function by choosing a different type for that

gopls/internal/protocol/command/interface.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ type Interface interface {
6969
// Runs `go generate` for a given directory.
7070
Generate(context.Context, GenerateArgs) error
7171

72-
// Doc: View package documentation.
72+
// Doc: Browse package documentation.
7373
//
7474
// Opens the Go package documentation page for the current
7575
// package in a browser.
@@ -242,7 +242,7 @@ type Interface interface {
242242
// This command is intended for use by gopls tests only.
243243
Views(context.Context) ([]View, error)
244244

245-
// FreeSymbols: View free symbols referenced by the selection in a browser.
245+
// FreeSymbols: Browse free symbols referenced by the selection in a browser.
246246
//
247247
// This command is a query over a selected range of Go source
248248
// code. It reports the set of "free" symbols of the
@@ -253,7 +253,7 @@ type Interface interface {
253253
// extracting it into a separate function.
254254
FreeSymbols(ctx context.Context, viewID string, loc protocol.Location) error
255255

256-
// Assembly: View assembly listing of current function in a browser.
256+
// Assembly: Browse assembly listing of current function in a browser.
257257
//
258258
// This command opens a web-based disassembly listing of the
259259
// specified function symbol (plus any nested lambdas and defers).

gopls/internal/test/integration/misc/webserver_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
)
2121

2222
// TestWebServer exercises the web server created on demand
23-
// for code actions such as "View package documentation".
23+
// for code actions such as "Browse package documentation".
2424
func TestWebServer(t *testing.T) {
2525
const files = `
2626
-- go.mod --
@@ -191,24 +191,24 @@ func Constructor() Type
191191
})
192192
}
193193

194-
// viewPkgDoc invokes the "View package documentation" code action in
194+
// viewPkgDoc invokes the "Browse package documentation" code action in
195195
// the specified file. It returns the URI of the document, or fails
196196
// the test.
197197
func viewPkgDoc(t *testing.T, env *Env, filename string) protocol.URI {
198198
env.OpenFile(filename)
199199

200-
// Invoke the "View package documentation" code
200+
// Invoke the "Browse package documentation" code
201201
// action to start the server.
202202
var docAction *protocol.CodeAction
203203
actions := env.CodeActionForFile(filename, nil)
204204
for _, act := range actions {
205-
if act.Title == "View package documentation" {
205+
if act.Title == "Browse package documentation" {
206206
docAction = &act
207207
break
208208
}
209209
}
210210
if docAction == nil {
211-
t.Fatalf("can't find action with Title 'View package documentation', only %#v",
211+
t.Fatalf("can't find action with Title 'Browse package documentation', only %#v",
212212
actions)
213213
}
214214

@@ -253,7 +253,7 @@ func f(buf bytes.Buffer, greeting string) {
253253
Run(t, files, func(t *testing.T, env *Env) {
254254
env.OpenFile("a/a.go")
255255

256-
// Invoke the "View free symbols" code
256+
// Invoke the "Browse free symbols" code
257257
// action to start the server.
258258
loc := env.RegexpSearch("a/a.go", "«((?:.|\n)*)»")
259259
actions, err := env.Editor.CodeAction(env.Ctx, loc, nil, protocol.CodeActionUnknownTrigger)
@@ -262,13 +262,13 @@ func f(buf bytes.Buffer, greeting string) {
262262
}
263263
var action *protocol.CodeAction
264264
for _, a := range actions {
265-
if a.Title == "View free symbols" {
265+
if a.Title == "Browse free symbols" {
266266
action = &a
267267
break
268268
}
269269
}
270270
if action == nil {
271-
t.Fatalf("can't find action with Title 'View free symbols', only %#v",
271+
t.Fatalf("can't find action with Title 'Browse free symbols', only %#v",
272272
actions)
273273
}
274274

@@ -320,13 +320,13 @@ func g() {
320320
Run(t, files, func(t *testing.T, env *Env) {
321321
env.OpenFile("a/a.go")
322322

323-
// Invoke the "View assembly" code action to start the server.
323+
// Invoke the "Browse assembly" code action to start the server.
324324
loc := env.RegexpSearch("a/a.go", "println")
325325
actions, err := env.Editor.CodeAction(env.Ctx, loc, nil, protocol.CodeActionUnknownTrigger)
326326
if err != nil {
327327
t.Fatalf("CodeAction: %v", err)
328328
}
329-
const wantTitle = "View " + runtime.GOARCH + " assembly for f"
329+
const wantTitle = "Browse " + runtime.GOARCH + " assembly for f"
330330
var action *protocol.CodeAction
331331
for _, a := range actions {
332332
if a.Title == wantTitle {

0 commit comments

Comments
 (0)