@@ -15,11 +15,10 @@ use serde::Deserialize;
1515
1616#[ derive( Debug , Clone ) ]
1717pub struct Config {
18+ pub client_caps : ClientCapsConfig ,
1819 pub publish_decorations : bool ,
1920 pub publish_diagnostics : bool ,
2021 pub notifications : NotificationsConfig ,
21- pub supports_location_link : bool ,
22- pub line_folding_only : bool ,
2322 pub inlay_hints : InlayHintsConfig ,
2423 pub completion : CompletionConfig ,
2524 pub call_info_full : bool ,
@@ -58,6 +57,12 @@ impl Default for RustfmtConfig {
5857 }
5958}
6059
60+ #[ derive( Debug , Clone , Default ) ]
61+ pub struct ClientCapsConfig {
62+ pub location_link : bool ,
63+ pub line_folding_only : bool ,
64+ }
65+
6166impl Default for Config {
6267 fn default ( ) -> Self {
6368 Config {
@@ -67,8 +72,7 @@ impl Default for Config {
6772 workspace_loaded : true ,
6873 cargo_toml_not_found : true ,
6974 } ,
70- supports_location_link : false ,
71- line_folding_only : false ,
75+ client_caps : ClientCapsConfig :: default ( ) ,
7276 inlay_hints : InlayHintsConfig {
7377 type_hints : true ,
7478 parameter_hints : true ,
@@ -97,11 +101,9 @@ impl Default for Config {
97101impl Config {
98102 #[ rustfmt:: skip]
99103 pub fn update ( & mut self , value : & serde_json:: Value ) {
100- let line_folding_only = self . line_folding_only ;
101- let supports_location_link = self . supports_location_link ;
104+ let client_caps = self . client_caps . clone ( ) ;
102105 * self = Default :: default ( ) ;
103- self . line_folding_only = line_folding_only;
104- self . supports_location_link = supports_location_link;
106+ self . client_caps = client_caps;
105107
106108 set ( value, "publishDecorations" , & mut self . publish_decorations ) ;
107109 set ( value, "excludeGlobs" , & mut self . exclude_globs ) ;
@@ -157,10 +159,10 @@ impl Config {
157159
158160 pub fn update_caps ( & mut self , caps : & TextDocumentClientCapabilities ) {
159161 if let Some ( value) = caps. definition . as_ref ( ) . and_then ( |it| it. link_support ) {
160- self . supports_location_link = value;
162+ self . client_caps . location_link = value;
161163 }
162164 if let Some ( value) = caps. folding_range . as_ref ( ) . and_then ( |it| it. line_folding_only ) {
163- self . line_folding_only = value
165+ self . client_caps . line_folding_only = value
164166 }
165167 }
166168}
0 commit comments