mirror of https://github.com/golang/go.git
internal/lsp/source: offer the fast fuzzy matcher as an option
Hook up the new fast SymbolMatcher as an option.
Benchmark ("test" in x/tools): 48ms->21ms (with the new matcher)
Benchmark ("test" in kubernetes): 857ms->199ms (with the new matcher)
Change-Id: Ic638eda1ed10572638f32879dd9b56467ae305ef
Reviewed-on: https://go-review.googlesource.com/c/tools/+/338695
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
parent
bfe69c31e5
commit
f35d7dcca5
|
|
@ -397,6 +397,7 @@ Must be one of:
|
|||
|
||||
* `"CaseInsensitive"`
|
||||
* `"CaseSensitive"`
|
||||
* `"FastFuzzy"`
|
||||
* `"Fuzzy"`
|
||||
Default: `"Fuzzy"`.
|
||||
|
||||
|
|
|
|||
|
|
@ -325,6 +325,10 @@ var GeneratedAPIJSON = &APIJSON{
|
|||
Value: "\"CaseSensitive\"",
|
||||
Doc: "",
|
||||
},
|
||||
{
|
||||
Value: "\"FastFuzzy\"",
|
||||
Doc: "",
|
||||
},
|
||||
{
|
||||
Value: "\"Fuzzy\"",
|
||||
Doc: "",
|
||||
|
|
|
|||
|
|
@ -543,6 +543,7 @@ type SymbolMatcher string
|
|||
|
||||
const (
|
||||
SymbolFuzzy SymbolMatcher = "Fuzzy"
|
||||
SymbolFastFuzzy SymbolMatcher = "FastFuzzy"
|
||||
SymbolCaseInsensitive SymbolMatcher = "CaseInsensitive"
|
||||
SymbolCaseSensitive SymbolMatcher = "CaseSensitive"
|
||||
)
|
||||
|
|
@ -834,6 +835,7 @@ func (o *Options) set(name string, value interface{}, seen map[string]struct{})
|
|||
case "symbolMatcher":
|
||||
if s, ok := result.asOneOf(
|
||||
string(SymbolFuzzy),
|
||||
string(SymbolFastFuzzy),
|
||||
string(SymbolCaseInsensitive),
|
||||
string(SymbolCaseSensitive),
|
||||
); ok {
|
||||
|
|
|
|||
|
|
@ -157,6 +157,8 @@ func newSymbolCollector(matcher SymbolMatcher, style SymbolStyle, query string)
|
|||
switch matcher {
|
||||
case SymbolFuzzy:
|
||||
m = parseQuery(query)
|
||||
case SymbolFastFuzzy:
|
||||
m = fuzzy.NewSymbolMatcher(query).Match
|
||||
case SymbolCaseSensitive:
|
||||
m = matchExact(query)
|
||||
case SymbolCaseInsensitive:
|
||||
|
|
|
|||
Loading…
Reference in New Issue