1
0
mirror of https://github.com/golang/go synced 2024-11-18 08:14:41 -07:00

internal/lsp: rename workspace symbol test symbols to avoid clash

In a later CL we include the fully qualified path to a symbol in the
Name field of SymbolInformation. This means that we end up with
matches like:

golang.org/x/tools/internal/lsp/workspacesymbol/b.WorkspaceSymbolVariableB

A fuzzy match against this name using the query "wsym" would match the
"workspacesymbol" of the import path as well as the
"WorkspaceSymbolVariableB" that is the symbol name itself.

Therefore we rename the symbols in the:

    internal/lsp/testdata/lsp/primarymod/workspacesymbol/...

from WorkspaceSymbol* to RandomGopher*, which allows our fuzzy matches
to be more precise.

Change-Id: Idbeb663f5750cae4835b0fdaa77531e30353fb89
Reviewed-on: https://go-review.googlesource.com/c/tools/+/228759
Run-TryBot: Paul Jolly <paul@myitcv.org.uk>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
Paul Jolly 2020-04-15 21:37:46 +01:00 committed by Paul Jolly
parent 0bd3dbed90
commit 1762287ae9
14 changed files with 49 additions and 49 deletions

View File

@ -1,9 +1,9 @@
package a
var WorkspaceSymbolVariableA = "a" //@symbol("WorkspaceSymbolVariableA", "WorkspaceSymbolVariableA", "Variable", "", "WorkspaceSymbolVariableA")
var RandomGopherVariableA = "a" //@symbol("RandomGopherVariableA", "RandomGopherVariableA", "Variable", "", "RandomGopherVariableA")
const WorkspaceSymbolConstantA = "a" //@symbol("WorkspaceSymbolConstantA", "WorkspaceSymbolConstantA", "Constant", "", "WorkspaceSymbolConstantA")
const RandomGopherConstantA = "a" //@symbol("RandomGopherConstantA", "RandomGopherConstantA", "Constant", "", "RandomGopherConstantA")
const (
workspacesymbolinvariable = iota //@symbol("workspacesymbolinvariable", "workspacesymbolinvariable", "Constant", "", "workspacesymbolinvariable")
randomgopherinvariable = iota //@symbol("randomgopherinvariable", "randomgopherinvariable", "Constant", "", "randomgopherinvariable")
)

View File

@ -1,5 +1,5 @@
-- symbols --
WorkspaceSymbolVariableA Variable 3:5-3:29
WorkspaceSymbolConstantA Constant 5:7-5:31
workspacesymbolinvariable Constant 8:2-8:27
RandomGopherVariableA Variable 3:5-3:26
RandomGopherConstantA Constant 5:7-5:28
randomgopherinvariable Constant 8:2-8:24

View File

@ -1,7 +1,7 @@
package b
var WorkspaceSymbolVariableB = "b" //@symbol("WorkspaceSymbolVariableB", "WorkspaceSymbolVariableB", "Variable", "", "WorkspaceSymbolVariableB")
var RandomGopherVariableB = "b" //@symbol("RandomGopherVariableB", "RandomGopherVariableB", "Variable", "", "RandomGopherVariableB")
type WorkspaceSymbolStructB struct { //@symbol("WorkspaceSymbolStructB", "WorkspaceSymbolStructB", "Struct", "", "WorkspaceSymbolStructB")
Bar int //@mark(bBar, "Bar"), symbol("Bar", "Bar", "Field", "WorkspaceSymbolStructB", "Bar")
type RandomGopherStructB struct { //@symbol("RandomGopherStructB", "RandomGopherStructB", "Struct", "", "RandomGopherStructB")
Bar int //@mark(bBar, "Bar"), symbol("Bar", "Bar", "Field", "RandomGopherStructB", "Bar")
}

View File

@ -1,5 +1,5 @@
-- symbols --
WorkspaceSymbolVariableB Variable 3:5-3:29
WorkspaceSymbolStructB Struct 5:6-5:28
RandomGopherVariableB Variable 3:5-3:26
RandomGopherStructB Struct 5:6-5:25
Bar Field 6:2-6:5

View File

@ -1,23 +1,23 @@
package fuzzy
/*@
workspacesymbolfuzzy("wsym",
WorkspaceSymbolVariableA,
WorkspaceSymbolConstantA,
workspacesymbolinvariable,
WorkspaceSymbolVariableB,
WorkspaceSymbolStructB,
workspacesymbolfuzzy("rgop",
RandomGopherVariableA,
RandomGopherConstantA,
randomgopherinvariable,
RandomGopherVariableB,
RandomGopherStructB,
)
workspacesymbolfuzzy("symbola",
WorkspaceSymbolVariableA,
WorkspaceSymbolConstantA,
workspacesymbolinvariable,
WorkspaceSymbolVariableB,
workspacesymbolfuzzy("randoma",
RandomGopherVariableA,
RandomGopherConstantA,
randomgopherinvariable,
RandomGopherVariableB,
)
workspacesymbolfuzzy("symbolb",
WorkspaceSymbolVariableA,
workspacesymbolinvariable,
WorkspaceSymbolVariableB,
WorkspaceSymbolStructB,
workspacesymbolfuzzy("randomb",
RandomGopherVariableA,
randomgopherinvariable,
RandomGopherVariableB,
RandomGopherStructB,
)
*/

View File

@ -0,0 +1,5 @@
-- workspace_symbol --
workspacesymbol/a/a.go:3:5-26 RandomGopherVariableA Variable
workspacesymbol/a/a.go:5:7-28 RandomGopherConstantA Constant
workspacesymbol/a/a.go:8:2-24 randomgopherinvariable Constant
workspacesymbol/b/b.go:3:5-26 RandomGopherVariableB Variable

View File

@ -0,0 +1,5 @@
-- workspace_symbol --
workspacesymbol/a/a.go:3:5-26 RandomGopherVariableA Variable
workspacesymbol/a/a.go:8:2-24 randomgopherinvariable Constant
workspacesymbol/b/b.go:3:5-26 RandomGopherVariableB Variable
workspacesymbol/b/b.go:5:6-25 RandomGopherStructB Struct

View File

@ -0,0 +1,6 @@
-- workspace_symbol --
workspacesymbol/a/a.go:3:5-26 RandomGopherVariableA Variable
workspacesymbol/a/a.go:5:7-28 RandomGopherConstantA Constant
workspacesymbol/a/a.go:8:2-24 randomgopherinvariable Constant
workspacesymbol/b/b.go:3:5-26 RandomGopherVariableB Variable
workspacesymbol/b/b.go:5:6-25 RandomGopherStructB Struct

View File

@ -1,5 +0,0 @@
-- workspace_symbol --
workspacesymbol/a/a.go:3:5-29 WorkspaceSymbolVariableA Variable
workspacesymbol/a/a.go:5:7-31 WorkspaceSymbolConstantA Constant
workspacesymbol/a/a.go:8:2-27 workspacesymbolinvariable Constant
workspacesymbol/b/b.go:3:5-29 WorkspaceSymbolVariableB Variable

View File

@ -1,5 +0,0 @@
-- workspace_symbol --
workspacesymbol/a/a.go:3:5-29 WorkspaceSymbolVariableA Variable
workspacesymbol/a/a.go:8:2-27 workspacesymbolinvariable Constant
workspacesymbol/b/b.go:3:5-29 WorkspaceSymbolVariableB Variable
workspacesymbol/b/b.go:5:6-28 WorkspaceSymbolStructB Struct

View File

@ -1,6 +0,0 @@
-- workspace_symbol --
workspacesymbol/a/a.go:3:5-29 WorkspaceSymbolVariableA Variable
workspacesymbol/a/a.go:5:7-31 WorkspaceSymbolConstantA Constant
workspacesymbol/a/a.go:8:2-27 workspacesymbolinvariable Constant
workspacesymbol/b/b.go:3:5-29 WorkspaceSymbolVariableB Variable
workspacesymbol/b/b.go:5:6-28 WorkspaceSymbolStructB Struct

View File

@ -0,0 +1,3 @@
-- workspace_symbol --
workspacesymbol/a/a.go:3:5-26 RandomGopherVariableA Variable
workspacesymbol/b/b.go:3:5-26 RandomGopherVariableB Variable

View File

@ -2,8 +2,8 @@ package workspacesymbol
/*@
workspacesymbol("") // The result is 0 symbols due to the limit(golang.org/cl/220939).
workspacesymbol("workspacesymbolvar",
WorkspaceSymbolVariableA,
WorkspaceSymbolVariableB,
workspacesymbol("randomgophervar",
RandomGopherVariableA,
RandomGopherVariableB,
)
*/

View File

@ -1,3 +0,0 @@
-- workspace_symbol --
workspacesymbol/a/a.go:3:5-29 WorkspaceSymbolVariableA Variable
workspacesymbol/b/b.go:3:5-29 WorkspaceSymbolVariableB Variable