зеркало из https://github.com/golang/tools.git
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>
This commit is contained in:
Родитель
a9021a544f
Коммит
bffeaaa266
|
@ -140,7 +140,7 @@ Result:
|
|||
}
|
||||
```
|
||||
|
||||
## `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 @@ Result:
|
|||
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
|
||||
|
|
|
@ -50,9 +50,9 @@ Editor support:
|
|||
|
||||
- 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 @@ the function by choosing a different type for that parameter.
|
|||
```
|
||||
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).
|
||||
|
|
|
@ -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": ""
|
||||
|
|
|
@ -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 @@ func AssemblyHTML(ctx context.Context, snapshot *cache.Snapshot, pkg *cache.Pack
|
|||
</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.
|
||||
|
|
|
@ -118,7 +118,7 @@ func CodeActions(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle,
|
|||
|
||||
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 @@ func getGoTestCodeActions(pkg *cache.Package, pgf *parsego.File, rng protocol.Ra
|
|||
}}, 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 @@ func getGoAssemblyAction(view *cache.View, pkg *cache.Package, pgf *parsego.File
|
|||
(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())
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -242,7 +242,7 @@ type Interface interface {
|
|||
// 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 @@ type Interface interface {
|
|||
// 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).
|
||||
|
|
|
@ -253,7 +253,7 @@ func f(buf bytes.Buffer, greeting string) {
|
|||
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 @@ func f(buf bytes.Buffer, greeting string) {
|
|||
}
|
||||
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 @@ func g() {
|
|||
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 {
|
||||
|
|
Загрузка…
Ссылка в новой задаче