@@ -16,20 +16,24 @@ use serde::Deserialize;
1616#[ derive( Debug , Clone ) ]
1717pub struct Config {
1818 pub client_caps : ClientCapsConfig ,
19+
20+ pub with_sysroot : bool ,
1921 pub publish_diagnostics : bool ,
20- pub notifications : NotificationsConfig ,
21- pub inlay_hints : InlayHintsConfig ,
22- pub completion : CompletionConfig ,
23- pub call_info_full : bool ,
24- pub rustfmt : RustfmtConfig ,
25- pub check : Option < FlycheckConfig > ,
22+ pub use_client_watching : bool ,
23+ // TODO: move to experimental capabilities
2624 pub vscode_lldb : bool ,
27- pub proc_macro_srv : Option < String > ,
2825 pub lru_capacity : Option < usize > ,
29- pub use_client_watching : bool ,
26+ pub proc_macro_srv : Option < String > ,
3027 pub exclude_globs : Vec < String > ,
28+ pub notifications : NotificationsConfig ,
29+
3130 pub cargo : CargoConfig ,
32- pub with_sysroot : bool ,
31+ pub rustfmt : RustfmtConfig ,
32+ pub check : Option < FlycheckConfig > ,
33+
34+ pub inlay_hints : InlayHintsConfig ,
35+ pub completion : CompletionConfig ,
36+ pub call_info_full : bool ,
3337}
3438
3539#[ derive( Debug , Clone ) ]
@@ -59,12 +63,28 @@ pub struct ClientCapsConfig {
5963impl Default for Config {
6064 fn default ( ) -> Self {
6165 Config {
66+ client_caps : ClientCapsConfig :: default ( ) ,
67+
68+ with_sysroot : true ,
6269 publish_diagnostics : true ,
70+ use_client_watching : false ,
71+ vscode_lldb : false ,
72+ lru_capacity : None ,
73+ proc_macro_srv : None ,
74+ exclude_globs : Vec :: new ( ) ,
6375 notifications : NotificationsConfig {
6476 workspace_loaded : true ,
6577 cargo_toml_not_found : true ,
6678 } ,
67- client_caps : ClientCapsConfig :: default ( ) ,
79+
80+ cargo : CargoConfig :: default ( ) ,
81+ rustfmt : RustfmtConfig :: Rustfmt { extra_args : Vec :: new ( ) } ,
82+ check : Some ( FlycheckConfig :: CargoCommand {
83+ command : "check" . to_string ( ) ,
84+ all_targets : true ,
85+ extra_args : Vec :: new ( ) ,
86+ } ) ,
87+
6888 inlay_hints : InlayHintsConfig {
6989 type_hints : true ,
7090 parameter_hints : true ,
@@ -77,19 +97,6 @@ impl Default for Config {
7797 add_call_argument_snippets : true ,
7898 } ,
7999 call_info_full : true ,
80- rustfmt : RustfmtConfig :: Rustfmt { extra_args : Vec :: new ( ) } ,
81- check : Some ( FlycheckConfig :: CargoCommand {
82- command : "check" . to_string ( ) ,
83- all_targets : true ,
84- extra_args : Vec :: new ( ) ,
85- } ) ,
86- vscode_lldb : false ,
87- proc_macro_srv : None ,
88- lru_capacity : None ,
89- use_client_watching : false ,
90- exclude_globs : Vec :: new ( ) ,
91- cargo : CargoConfig :: default ( ) ,
92- with_sysroot : true ,
93100 }
94101 }
95102}
@@ -103,15 +110,22 @@ impl Config {
103110 * self = Default :: default ( ) ;
104111 self . client_caps = client_caps;
105112
106- set ( value, "/excludeGlobs" , & mut self . exclude_globs ) ;
113+ set ( value, "/withSysroot" , & mut self . with_sysroot ) ;
114+ set ( value, "/featureFlags/lsp.diagnostics" , & mut self . publish_diagnostics ) ;
107115 set ( value, "/useClientWatching" , & mut self . use_client_watching ) ;
116+ set ( value, "/vscodeLldb" , & mut self . vscode_lldb ) ;
108117 set ( value, "/lruCapacity" , & mut self . lru_capacity ) ;
118+ set ( value, "/excludeGlobs" , & mut self . exclude_globs ) ;
119+ set ( value, "/featureFlags/notifications.workspace-loaded" , & mut self . notifications . workspace_loaded ) ;
120+ set ( value, "/featureFlags/notifications.cargo-toml-not-found" , & mut self . notifications . cargo_toml_not_found ) ;
109121
110- set ( value, "/inlayHintsType" , & mut self . inlay_hints . type_hints ) ;
111- set ( value, "/inlayHintsParameter" , & mut self . inlay_hints . parameter_hints ) ;
112- set ( value, "/inlayHintsChaining" , & mut self . inlay_hints . chaining_hints ) ;
113- set ( value, "/inlayHintsMaxLength" , & mut self . inlay_hints . max_length ) ;
114-
122+ set ( value, "/cargoFeatures/noDefaultFeatures" , & mut self . cargo . no_default_features ) ;
123+ set ( value, "/cargoFeatures/allFeatures" , & mut self . cargo . all_features ) ;
124+ set ( value, "/cargoFeatures/features" , & mut self . cargo . features ) ;
125+ set ( value, "/cargoFeatures/loadOutDirsFromCheck" , & mut self . cargo . load_out_dirs_from_check ) ;
126+ if let RustfmtConfig :: Rustfmt { extra_args } = & mut self . rustfmt {
127+ set ( value, "/rustfmtArgs" , extra_args) ;
128+ }
115129 if let Some ( false ) = get ( value, "cargo_watch_enable" ) {
116130 self . check = None
117131 } else {
@@ -123,21 +137,10 @@ impl Config {
123137 }
124138 } ;
125139
126- set ( value, "/withSysroot" , & mut self . with_sysroot ) ;
127- if let RustfmtConfig :: Rustfmt { extra_args } = & mut self . rustfmt {
128- set ( value, "/rustfmtArgs" , extra_args) ;
129- }
130-
131- set ( value, "/cargoFeatures/noDefaultFeatures" , & mut self . cargo . no_default_features ) ;
132- set ( value, "/cargoFeatures/allFeatures" , & mut self . cargo . all_features ) ;
133- set ( value, "/cargoFeatures/features" , & mut self . cargo . features ) ;
134- set ( value, "/cargoFeatures/loadOutDirsFromCheck" , & mut self . cargo . load_out_dirs_from_check ) ;
135-
136- set ( value, "/vscodeLldb" , & mut self . vscode_lldb ) ;
137-
138- set ( value, "/featureFlags/lsp.diagnostics" , & mut self . publish_diagnostics ) ;
139- set ( value, "/featureFlags/notifications.workspace-loaded" , & mut self . notifications . workspace_loaded ) ;
140- set ( value, "/featureFlags/notifications.cargo-toml-not-found" , & mut self . notifications . cargo_toml_not_found ) ;
140+ set ( value, "/inlayHintsType" , & mut self . inlay_hints . type_hints ) ;
141+ set ( value, "/inlayHintsParameter" , & mut self . inlay_hints . parameter_hints ) ;
142+ set ( value, "/inlayHintsChaining" , & mut self . inlay_hints . chaining_hints ) ;
143+ set ( value, "/inlayHintsMaxLength" , & mut self . inlay_hints . max_length ) ;
141144 set ( value, "/featureFlags/completion.enable-postfix" , & mut self . completion . enable_postfix_completions ) ;
142145 set ( value, "/featureFlags/completion.insertion.add-call-parenthesis" , & mut self . completion . add_call_parenthesis ) ;
143146 set ( value, "/featureFlags/completion.insertion.add-argument-snippets" , & mut self . completion . add_call_argument_snippets ) ;
0 commit comments