File tree Expand file tree Collapse file tree 4 files changed +26
-1
lines changed Expand file tree Collapse file tree 4 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -512,6 +512,8 @@ config_data! {
512
512
completion_termSearch_enable: bool = false ,
513
513
/// Term search fuel in "units of work" for autocompletion (Defaults to 1000).
514
514
completion_termSearch_fuel: usize = 1000 ,
515
+ /// Whether to omit deprecated items from autocompletion. By default they are marked as deprecated but not hidden.
516
+ completions_hideDeprecated: bool = false ,
515
517
516
518
/// Controls file watching implementation.
517
519
files_watcher: FilesWatcherDef = FilesWatcherDef :: Client ,
@@ -1435,6 +1437,10 @@ impl Config {
1435
1437
}
1436
1438
}
1437
1439
1440
+ pub fn completion_hide_deprecated ( & self ) -> bool {
1441
+ * self . completions_hideDeprecated ( )
1442
+ }
1443
+
1438
1444
pub fn detached_files ( & self ) -> & Vec < AbsPathBuf > {
1439
1445
// FIXME @alibektas : This is the only config that is confusing. If it's a proper configuration
1440
1446
// why is it not among the others? If it's client only which I doubt it is current state should be alright
Original file line number Diff line number Diff line change @@ -228,8 +228,12 @@ pub(crate) fn completion_items(
228
228
line_index : & LineIndex ,
229
229
version : Option < i32 > ,
230
230
tdpp : lsp_types:: TextDocumentPositionParams ,
231
- items : Vec < CompletionItem > ,
231
+ mut items : Vec < CompletionItem > ,
232
232
) -> Vec < lsp_types:: CompletionItem > {
233
+ if config. completion_hide_deprecated ( ) {
234
+ items. retain ( |item| !item. deprecated ) ;
235
+ }
236
+
233
237
let max_relevance = items. iter ( ) . map ( |it| it. relevance . score ( ) ) . max ( ) . unwrap_or_default ( ) ;
234
238
let mut res = Vec :: with_capacity ( items. len ( ) ) ;
235
239
for item in items {
Original file line number Diff line number Diff line change @@ -358,6 +358,11 @@ Whether to enable term search based snippets like `Some(foo.bar().baz())`.
358
358
--
359
359
Term search fuel in "units of work" for autocompletion (Defaults to 1000).
360
360
--
361
+ [[rust-analyzer.completions.hideDeprecated]]rust-analyzer.completions.hideDeprecated (default: `false` )::
362
+ +
363
+ --
364
+ Whether to omit deprecated items from autocompletion. By default they are marked as deprecated but not hidden.
365
+ --
361
366
[[rust-analyzer.diagnostics.disabled]]rust-analyzer.diagnostics.disabled (default: `[]` )::
362
367
+
363
368
--
Original file line number Diff line number Diff line change 1182
1182
}
1183
1183
}
1184
1184
},
1185
+ {
1186
+ "title" : " completions" ,
1187
+ "properties" : {
1188
+ "rust-analyzer.completions.hideDeprecated" : {
1189
+ "markdownDescription" : " Whether to omit deprecated items from autocompletion. By default they are marked as deprecated but not hidden." ,
1190
+ "default" : false ,
1191
+ "type" : " boolean"
1192
+ }
1193
+ }
1194
+ },
1185
1195
{
1186
1196
"title" : " diagnostics" ,
1187
1197
"properties" : {
You can’t perform that action at this time.
0 commit comments