about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAli Bektas <bektasali@protonmail.com>2025-01-03 14:36:40 +0100
committerAli Bektas <bektasali@protonmail.com>2025-01-03 14:36:40 +0100
commitfc3e0a15df15d63a8c44909031fb618a16a8558c (patch)
treeb83843017a70fd88c178d33bf98b2ce6f94c182b
parentb4f865a70117f31e71e99ff6b03e6d38aeeb4c43 (diff)
downloadrust-fc3e0a15df15d63a8c44909031fb618a16a8558c.tar.gz
rust-fc3e0a15df15d63a8c44909031fb618a16a8558c.zip
fix: 18814
-rw-r--r--src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs11
1 files changed, 9 insertions, 2 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 2bb1406a97d..5bba3b64b3f 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs
@@ -910,11 +910,18 @@ impl Config {
 
                 patch_old_style::patch_json_for_outdated_configs(&mut json);
 
+                let mut json_errors = vec![];
+                let snips = get_field_json::<FxHashMap<String, SnippetDef>>(
+                    &mut json,
+                    &mut json_errors,
+                    "completion_snippets_custom",
+                    None,
+                )
+                .unwrap_or(self.completion_snippets_custom().to_owned());
+
                 // IMPORTANT : This holds as long as ` completion_snippets_custom` is declared `client`.
                 config.snippets.clear();
 
-                let snips = self.completion_snippets_custom().to_owned();
-
                 for (name, def) in snips.iter() {
                     if def.prefix.is_empty() && def.postfix.is_empty() {
                         continue;