@@ -87,11 +87,16 @@ pub enum DefaultFeatures {
8787 Diagnostics ,
8888 FindReferences ,
8989 GotoDefinition ,
90+ GotoTypeDefinition ,
9091 Hover ,
9192 InlayHint ,
9293 Rename ,
9394 SemanticTokens ,
9495 SignatureHelp ,
96+ DocumentHighlight ,
97+ DocumentLink ,
98+ FoldingRange ,
99+ SelectionRange ,
95100 /* ELS specific features */
96101 SmartCompletion ,
97102 DeepCompletion ,
@@ -116,9 +121,20 @@ impl From<&str> for DefaultFeatures {
116121 "gotodefinition" | "gotoDefinition" | "goto-definition" => {
117122 DefaultFeatures :: GotoDefinition
118123 }
124+ "gototypedefinition" | "gotoTypeDefinition" | "goto-type-definition" => {
125+ DefaultFeatures :: GotoTypeDefinition
126+ }
119127 "signaturehelp" | "signatureHelp" | "signature-help" | "code-signature" => {
120128 DefaultFeatures :: SignatureHelp
121129 }
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+ }
122138 "smartcompletion" | "smartCompletion" | "smart-completion" => {
123139 DefaultFeatures :: SmartCompletion
124140 }
@@ -452,7 +468,14 @@ impl<Checker: BuildRunnable, Parser: Parsable> Server<Checker, Parser> {
452468 let mut comp_options = CompletionOptions :: default ( ) ;
453469 comp_options. trigger_characters = Some ( TRIGGER_CHARS . map ( String :: from) . to_vec ( ) ) ;
454470 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+ } ;
456479 capabilities. rename_provider = Some ( OneOf :: Left ( true ) ) ;
457480 capabilities. references_provider = Some ( OneOf :: Left ( true ) ) ;
458481 capabilities. definition_provider = Some ( OneOf :: Left ( true ) ) ;
@@ -530,20 +553,40 @@ impl<Checker: BuildRunnable, Parser: Parsable> Server<Checker, Parser> {
530553 work_done_progress : None ,
531554 } ,
532555 } ) ;
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+ } ;
536564 capabilities. workspace_symbol_provider = Some ( OneOf :: Left ( true ) ) ;
537565 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+ } ;
542577 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+ ) ) ;
544583 capabilities. selection_range_provider =
545584 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+ ) ) ;
547590 capabilities
548591 }
549592
0 commit comments