@@ -87,11 +87,16 @@ pub enum DefaultFeatures {
87
87
Diagnostics ,
88
88
FindReferences ,
89
89
GotoDefinition ,
90
+ GotoTypeDefinition ,
90
91
Hover ,
91
92
InlayHint ,
92
93
Rename ,
93
94
SemanticTokens ,
94
95
SignatureHelp ,
96
+ DocumentHighlight ,
97
+ DocumentLink ,
98
+ FoldingRange ,
99
+ SelectionRange ,
95
100
/* ELS specific features */
96
101
SmartCompletion ,
97
102
DeepCompletion ,
@@ -116,9 +121,20 @@ impl From<&str> for DefaultFeatures {
116
121
"gotodefinition" | "gotoDefinition" | "goto-definition" => {
117
122
DefaultFeatures :: GotoDefinition
118
123
}
124
+ "gototypedefinition" | "gotoTypeDefinition" | "goto-type-definition" => {
125
+ DefaultFeatures :: GotoTypeDefinition
126
+ }
119
127
"signaturehelp" | "signatureHelp" | "signature-help" | "code-signature" => {
120
128
DefaultFeatures :: SignatureHelp
121
129
}
130
+ "documenthighlight" | "documentHighlight" | "document-highlight" => {
131
+ DefaultFeatures :: DocumentHighlight
132
+ }
133
+ "documentlink" | "documentLink" | "document-link" => DefaultFeatures :: DocumentLink ,
134
+ "foldingrange" | "foldingRange" | "folding-range" => DefaultFeatures :: FoldingRange ,
135
+ "selectionrange" | "selectionRange" | "selection-range" => {
136
+ DefaultFeatures :: SelectionRange
137
+ }
122
138
"smartcompletion" | "smartCompletion" | "smart-completion" => {
123
139
DefaultFeatures :: SmartCompletion
124
140
}
@@ -452,7 +468,14 @@ impl<Checker: BuildRunnable, Parser: Parsable> Server<Checker, Parser> {
452
468
let mut comp_options = CompletionOptions :: default ( ) ;
453
469
comp_options. trigger_characters = Some ( TRIGGER_CHARS . map ( String :: from) . to_vec ( ) ) ;
454
470
comp_options. resolve_provider = Some ( true ) ;
455
- capabilities. completion_provider = Some ( comp_options) ;
471
+ capabilities. completion_provider = if self
472
+ . disabled_features
473
+ . contains ( & DefaultFeatures :: Completion )
474
+ {
475
+ None
476
+ } else {
477
+ Some ( comp_options)
478
+ } ;
456
479
capabilities. rename_provider = Some ( OneOf :: Left ( true ) ) ;
457
480
capabilities. references_provider = Some ( OneOf :: Left ( true ) ) ;
458
481
capabilities. definition_provider = Some ( OneOf :: Left ( true ) ) ;
@@ -530,20 +553,40 @@ impl<Checker: BuildRunnable, Parser: Parsable> Server<Checker, Parser> {
530
553
work_done_progress : None ,
531
554
} ,
532
555
} ) ;
533
- capabilities. code_lens_provider = Some ( CodeLensOptions {
534
- resolve_provider : Some ( false ) ,
535
- } ) ;
556
+ capabilities. code_lens_provider =
557
+ if self . disabled_features . contains ( & DefaultFeatures :: CodeLens ) {
558
+ None
559
+ } else {
560
+ Some ( CodeLensOptions {
561
+ resolve_provider : Some ( false ) ,
562
+ } )
563
+ } ;
536
564
capabilities. workspace_symbol_provider = Some ( OneOf :: Left ( true ) ) ;
537
565
capabilities. document_symbol_provider = Some ( OneOf :: Left ( true ) ) ;
538
- capabilities. document_link_provider = Some ( DocumentLinkOptions {
539
- resolve_provider : Some ( false ) ,
540
- work_done_progress_options : Default :: default ( ) ,
541
- } ) ;
566
+ capabilities. document_link_provider = if self
567
+ . disabled_features
568
+ . contains ( & DefaultFeatures :: DocumentLink )
569
+ {
570
+ None
571
+ } else {
572
+ Some ( DocumentLinkOptions {
573
+ resolve_provider : Some ( false ) ,
574
+ work_done_progress_options : Default :: default ( ) ,
575
+ } )
576
+ } ;
542
577
capabilities. call_hierarchy_provider = Some ( CallHierarchyServerCapability :: Simple ( true ) ) ;
543
- capabilities. folding_range_provider = Some ( FoldingRangeProviderCapability :: Simple ( true ) ) ;
578
+ capabilities. folding_range_provider = Some ( FoldingRangeProviderCapability :: Simple (
579
+ self . disabled_features
580
+ . contains ( & DefaultFeatures :: FoldingRange )
581
+ . not ( ) ,
582
+ ) ) ;
544
583
capabilities. selection_range_provider =
545
584
Some ( SelectionRangeProviderCapability :: Simple ( true ) ) ;
546
- capabilities. document_highlight_provider = Some ( OneOf :: Left ( true ) ) ;
585
+ capabilities. document_highlight_provider = Some ( OneOf :: Left (
586
+ self . disabled_features
587
+ . contains ( & DefaultFeatures :: DocumentHighlight )
588
+ . not ( ) ,
589
+ ) ) ;
547
590
capabilities
548
591
}
549
592
0 commit comments