@@ -143,6 +143,7 @@ func DefaultOptions() *Options {
143
143
ImportShortcut : BothShortcuts ,
144
144
SymbolMatcher : SymbolFastFuzzy ,
145
145
SymbolStyle : DynamicSymbols ,
146
+ SymbolScope : WorkspaceSymbolScope ,
146
147
},
147
148
CompletionOptions : CompletionOptions {
148
149
Matcher : Fuzzy ,
@@ -454,6 +455,13 @@ type NavigationOptions struct {
454
455
// }
455
456
// ```
456
457
SymbolStyle SymbolStyle `status:"advanced"`
458
+
459
+ // SymbolScope controls which packages are searched for workspace/symbol
460
+ // requests. The default value, "workspace", searches only workspace
461
+ // packages. The legacy behavior, "all", causes all loaded packages to be
462
+ // searched, including dependencies; this is more expensive and may return
463
+ // unwanted results.
464
+ SymbolScope SymbolScope
457
465
}
458
466
459
467
// UserOptions holds custom Gopls configuration (not part of the LSP) that is
@@ -617,6 +625,8 @@ const (
617
625
CaseSensitive Matcher = "CaseSensitive"
618
626
)
619
627
628
+ // A SymbolMatcher controls the matching of symbols for workspace/symbol
629
+ // requests.
620
630
type SymbolMatcher string
621
631
622
632
const (
@@ -626,6 +636,7 @@ const (
626
636
SymbolCaseSensitive SymbolMatcher = "CaseSensitive"
627
637
)
628
638
639
+ // A SymbolStyle controls the formatting of symbols in workspace/symbol results.
629
640
type SymbolStyle string
630
641
631
642
const (
@@ -642,6 +653,17 @@ const (
642
653
DynamicSymbols SymbolStyle = "Dynamic"
643
654
)
644
655
656
+ // A SymbolScope controls the search scope for workspace/symbol requests.
657
+ type SymbolScope string
658
+
659
+ const (
660
+ // WorkspaceSymbolScope matches symbols in workspace packages only.
661
+ WorkspaceSymbolScope SymbolScope = "workspace"
662
+ // AllSymbolScope matches symbols in any loaded package, including
663
+ // dependencies.
664
+ AllSymbolScope SymbolScope = "all"
665
+ )
666
+
645
667
type HoverKind string
646
668
647
669
const (
@@ -969,6 +991,14 @@ func (o *Options) set(name string, value interface{}, seen map[string]struct{})
969
991
o .SymbolStyle = SymbolStyle (s )
970
992
}
971
993
994
+ case "symbolScope" :
995
+ if s , ok := result .asOneOf (
996
+ string (WorkspaceSymbolScope ),
997
+ string (AllSymbolScope ),
998
+ ); ok {
999
+ o .SymbolScope = SymbolScope (s )
1000
+ }
1001
+
972
1002
case "hoverKind" :
973
1003
if s , ok := result .asOneOf (
974
1004
string (NoDocumentation ),
0 commit comments