@@ -18,13 +18,13 @@ pub struct Config {
1818 pub client_caps : ClientCapsConfig ,
1919
2020 pub with_sysroot : bool ,
21+ // TODO: verify that it means what I think it means
2122 pub publish_diagnostics : bool ,
22- pub use_client_watching : bool ,
2323 // TODO: move to experimental capabilities
2424 pub vscode_lldb : bool ,
2525 pub lru_capacity : Option < usize > ,
2626 pub proc_macro_srv : Option < String > ,
27- pub exclude_globs : Vec < String > ,
27+ pub files : FilesConfig ,
2828 pub notifications : NotificationsConfig ,
2929
3030 pub cargo : CargoConfig ,
@@ -36,6 +36,18 @@ pub struct Config {
3636 pub call_info_full : bool ,
3737}
3838
39+ #[ derive( Debug , Clone ) ]
40+ pub struct FilesConfig {
41+ watcher : FilesWatcher ,
42+ exclude : Vec < String > ,
43+ }
44+
45+ #[ derive( Debug , Clone ) ]
46+ enum FilesWatcher {
47+ Client ,
48+ Notify ,
49+ }
50+
3951#[ derive( Debug , Clone ) ]
4052pub struct NotificationsConfig {
4153 pub workspace_loaded : bool ,
@@ -67,11 +79,10 @@ impl Default for Config {
6779
6880 with_sysroot : true ,
6981 publish_diagnostics : true ,
70- use_client_watching : false ,
7182 vscode_lldb : false ,
7283 lru_capacity : None ,
7384 proc_macro_srv : None ,
74- exclude_globs : Vec :: new ( ) ,
85+ files : FilesConfig { watcher : FilesWatcher :: Notify , exclude : Vec :: new ( ) } ,
7586 notifications : NotificationsConfig {
7687 workspace_loaded : true ,
7788 cargo_toml_not_found : true ,
@@ -112,39 +123,43 @@ impl Config {
112123
113124 set ( value, "/withSysroot" , & mut self . with_sysroot ) ;
114125 set ( value, "/featureFlags/lsp.diagnostics" , & mut self . publish_diagnostics ) ;
115- set ( value, "/useClientWatching" , & mut self . use_client_watching ) ;
116126 set ( value, "/vscodeLldb" , & mut self . vscode_lldb ) ;
117127 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 ) ;
121-
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 ) ;
128+ if let Some ( watcher) = get :: < String > ( value, "/files/watcher" ) {
129+ self . files . watcher = match watcher. as_str ( ) {
130+ "client" => FilesWatcher :: Client ,
131+ "notify" | _ => FilesWatcher :: Notify ,
132+ }
133+ }
134+ set ( value, "/notifications/workspaceLoaded" , & mut self . notifications . workspace_loaded ) ;
135+ set ( value, "/notifications/cargoTomlNotFound" , & mut self . notifications . cargo_toml_not_found ) ;
136+
137+ set ( value, "/cargo/noDefaultFeatures" , & mut self . cargo . no_default_features ) ;
138+ set ( value, "/cargo/allFeatures" , & mut self . cargo . all_features ) ;
139+ set ( value, "/cargo/features" , & mut self . cargo . features ) ;
140+ set ( value, "/cargo/loadOutDirsFromCheck" , & mut self . cargo . load_out_dirs_from_check ) ;
126141 if let RustfmtConfig :: Rustfmt { extra_args } = & mut self . rustfmt {
127- set ( value, "/rustfmtArgs " , extra_args) ;
142+ set ( value, "/rustfmt/extraArgs " , extra_args) ;
128143 }
129- if let Some ( false ) = get ( value, "cargo_watch_enable " ) {
144+ if let Some ( false ) = get ( value, "/checkOnSave/enable " ) {
130145 self . check = None
131146 } else {
132147 if let Some ( FlycheckConfig :: CargoCommand { command, extra_args, all_targets } ) = & mut self . check
133148 {
134- set ( value, "/cargoWatchArgs " , extra_args) ;
135- set ( value, "/cargoWatchCommand " , command) ;
136- set ( value, "/cargoWatchAllTargets " , all_targets) ;
149+ set ( value, "/checkOnSave/extraArgs " , extra_args) ;
150+ set ( value, "/checkOnSave/command " , command) ;
151+ set ( value, "/checkOnSave/allTargets " , all_targets) ;
137152 }
138153 } ;
139154
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 ) ;
144- set ( value, "/featureFlags/ completion.enable- postfix" , & mut self . completion . enable_postfix_completions ) ;
145- set ( value, "/featureFlags/ completion.insertion.add-call-parenthesis " , & mut self . completion . add_call_parenthesis ) ;
146- set ( value, "/featureFlags/ completion.insertion.add-argument-snippets " , & mut self . completion . add_call_argument_snippets ) ;
147- set ( value, "/featureFlags/call-info. full" , & mut self . call_info_full ) ;
155+ set ( value, "/inlayHints/typeHints " , & mut self . inlay_hints . type_hints ) ;
156+ set ( value, "/inlayHints/parameterHints " , & mut self . inlay_hints . parameter_hints ) ;
157+ set ( value, "/inlayHints/chainingHints " , & mut self . inlay_hints . chaining_hints ) ;
158+ set ( value, "/inlayHints/maxLength " , & mut self . inlay_hints . max_length ) ;
159+ set ( value, "/completion/ postfix/enable " , & mut self . completion . enable_postfix_completions ) ;
160+ set ( value, "/completion/addCallParenthesis " , & mut self . completion . add_call_parenthesis ) ;
161+ set ( value, "/completion/addCallArgumentSnippets " , & mut self . completion . add_call_argument_snippets ) ;
162+ set ( value, "/callInfo/ full" , & mut self . call_info_full ) ;
148163
149164 log:: info!( "Config::update() = {:#?}" , self ) ;
150165
0 commit comments