mirror of
https://github.com/golang/go
synced 2024-11-18 16:44:43 -07:00
internal/lsp/tests: fix WorkspaceSymbols tests
The tests will not run because there is no workspacesymbol marker. Therefore, restore testdata used in WorkspaceSymbols tests, and initialize data so that the tests run even if the target of the marker is 0. Change-Id: I051b842183b7e23bb746cc282fc3921a90ca8df1 Reviewed-on: https://go-review.googlesource.com/c/tools/+/221617 Reviewed-by: Heschi Kreinick <heschi@google.com> Run-TryBot: Heschi Kreinick <heschi@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
aafaee8bce
commit
0d653b92c5
9
internal/lsp/testdata/lsp/primarymod/workspacesymbol/workspacesymbol.go
vendored
Normal file
9
internal/lsp/testdata/lsp/primarymod/workspacesymbol/workspacesymbol.go
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
package workspacesymbol
|
||||
|
||||
/*@
|
||||
workspacesymbol("") // The result is 0 symbols due to the limit(golang.org/cl/220939).
|
||||
workspacesymbol("workspacesymbolvar",
|
||||
WorkspaceSymbolVariableA,
|
||||
WorkspaceSymbolVariableB,
|
||||
)
|
||||
*/
|
2
internal/lsp/testdata/lsp/summary.txt.golden
vendored
2
internal/lsp/testdata/lsp/summary.txt.golden
vendored
@ -19,7 +19,7 @@ ReferencesCount = 9
|
||||
RenamesCount = 23
|
||||
PrepareRenamesCount = 7
|
||||
SymbolsCount = 3
|
||||
WorkspaceSymbolsCount = 0
|
||||
WorkspaceSymbolsCount = 2
|
||||
FuzzyWorkspaceSymbolsCount = 3
|
||||
CaseSensitiveWorkspaceSymbolsCount = 2
|
||||
SignaturesCount = 24
|
||||
|
@ -1112,18 +1112,21 @@ func (data *Data) collectWorkspaceSymbols(typ WorkspaceSymbolsTestType) func(str
|
||||
switch typ {
|
||||
case WorkspaceSymbolsFuzzy:
|
||||
return func(query string, targets []span.Span) {
|
||||
data.FuzzyWorkspaceSymbols[query] = make([]protocol.SymbolInformation, 0, len(targets))
|
||||
for _, target := range targets {
|
||||
data.FuzzyWorkspaceSymbols[query] = append(data.FuzzyWorkspaceSymbols[query], data.symbolInformation[target])
|
||||
}
|
||||
}
|
||||
case WorkspaceSymbolsCaseSensitive:
|
||||
return func(query string, targets []span.Span) {
|
||||
data.CaseSensitiveWorkspaceSymbols[query] = make([]protocol.SymbolInformation, 0, len(targets))
|
||||
for _, target := range targets {
|
||||
data.CaseSensitiveWorkspaceSymbols[query] = append(data.CaseSensitiveWorkspaceSymbols[query], data.symbolInformation[target])
|
||||
}
|
||||
}
|
||||
default:
|
||||
return func(query string, targets []span.Span) {
|
||||
data.WorkspaceSymbols[query] = make([]protocol.SymbolInformation, 0, len(targets))
|
||||
for _, target := range targets {
|
||||
data.WorkspaceSymbols[query] = append(data.WorkspaceSymbols[query], data.symbolInformation[target])
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user