diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2025-04-21 06:28:45 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-21 06:28:45 +0000 |
| commit | 8f80674dd6628cc3a4d10b17b57d4323febbcd92 (patch) | |
| tree | 8fcd3df1ceaa048c982e6f551cfc2cb51c9df2cb | |
| parent | 31c591846348793d59f99a86778e2dd2e3df2442 (diff) | |
| parent | 5d12827099a2c9927f8f3213d2048d2543a6fddc (diff) | |
| download | rust-8f80674dd6628cc3a4d10b17b57d4323febbcd92.tar.gz rust-8f80674dd6628cc3a4d10b17b57d4323febbcd92.zip | |
Merge pull request #19636 from Veykril/push-wttkunmqyskm
fix: Fix completion_snippets_custom config always erroring
| -rw-r--r-- | src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs index 1f44889883f..619cf3d5011 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs @@ -923,7 +923,6 @@ impl Config { if !(json.is_null() || json.as_object().is_some_and(|it| it.is_empty())) { let detached_files = get_field_json::<Vec<Utf8PathBuf>>( &mut json, - // Do not record errors here; it is not an error if a field is missing here. &mut Vec::new(), "detachedFiles", None, @@ -935,19 +934,20 @@ impl Config { patch_old_style::patch_json_for_outdated_configs(&mut json); - let snips = get_field_json::<FxIndexMap<String, SnippetDef>>( - &mut json, - // Do not record errors here; it is not an error if a field is missing here. - &mut Vec::new(), - "completion_snippets_custom", - None, - ) - .unwrap_or(self.completion_snippets_custom().to_owned()); - let mut json_errors = vec![]; + + let input = FullConfigInput::from_json(json, &mut json_errors); + // IMPORTANT : This holds as long as ` completion_snippets_custom` is declared `client`. config.snippets.clear(); + let snips = input + .global + .completion_snippets_custom + .as_ref() + .unwrap_or(&self.default_config.global.completion_snippets_custom); + #[allow(dead_code)] + let _ = Self::completion_snippets_custom; for (name, def) in snips.iter() { if def.prefix.is_empty() && def.postfix.is_empty() { continue; @@ -974,8 +974,9 @@ impl Config { )), } } + config.client_config = ( - FullConfigInput::from_json(json, &mut json_errors), + input, ConfigErrors( json_errors .into_iter() |
