@@ -41,6 +41,8 @@ use crate::{
4141 lsp_ext:: { WorkspaceSymbolSearchKind , WorkspaceSymbolSearchScope } ,
4242} ;
4343
44+ type FxIndexMap < K , V > = indexmap:: IndexMap < K , V , rustc_hash:: FxBuildHasher > ;
45+
4446mod patch_old_style;
4547
4648// Conventions for configuration keys to preserve maximal extendability without breakage:
@@ -81,7 +83,7 @@ config_data! {
8183 cachePriming_numThreads: NumThreads = NumThreads :: Physical ,
8284
8385 /// Custom completion snippets.
84- completion_snippets_custom: FxHashMap <String , SnippetDef > = Config :: completion_snippets_default( ) ,
86+ completion_snippets_custom: FxIndexMap <String , SnippetDef > = Config :: completion_snippets_default( ) ,
8587
8688
8789 /// These paths (file/directories) will be ignored by rust-analyzer. They are
@@ -931,7 +933,7 @@ impl Config {
931933 patch_old_style:: patch_json_for_outdated_configs ( & mut json) ;
932934
933935 let mut json_errors = vec ! [ ] ;
934- let snips = get_field_json :: < FxHashMap < String , SnippetDef > > (
936+ let snips = get_field_json :: < FxIndexMap < String , SnippetDef > > (
935937 & mut json,
936938 & mut json_errors,
937939 "completion_snippets_custom" ,
@@ -2032,21 +2034,13 @@ impl Config {
20322034 * self . cfg_setTest ( source_root)
20332035 }
20342036
2035- pub ( crate ) fn completion_snippets_default ( ) -> FxHashMap < String , SnippetDef > {
2037+ pub ( crate ) fn completion_snippets_default ( ) -> FxIndexMap < String , SnippetDef > {
20362038 serde_json:: from_str (
20372039 r#"{
2038- "Arc::new": {
2039- "postfix": "arc",
2040- "body": "Arc::new(${receiver})",
2041- "requires": "std::sync::Arc",
2042- "description": "Put the expression into an `Arc`",
2043- "scope": "expr"
2044- },
2045- "Rc::new": {
2046- "postfix": "rc",
2047- "body": "Rc::new(${receiver})",
2048- "requires": "std::rc::Rc",
2049- "description": "Put the expression into an `Rc`",
2040+ "Ok": {
2041+ "postfix": "ok",
2042+ "body": "Ok(${receiver})",
2043+ "description": "Wrap the expression in a `Result::Ok`",
20502044 "scope": "expr"
20512045 },
20522046 "Box::pin": {
@@ -2056,10 +2050,17 @@ impl Config {
20562050 "description": "Put the expression into a pinned `Box`",
20572051 "scope": "expr"
20582052 },
2059- "Ok": {
2060- "postfix": "ok",
2061- "body": "Ok(${receiver})",
2062- "description": "Wrap the expression in a `Result::Ok`",
2053+ "Arc::new": {
2054+ "postfix": "arc",
2055+ "body": "Arc::new(${receiver})",
2056+ "requires": "std::sync::Arc",
2057+ "description": "Put the expression into an `Arc`",
2058+ "scope": "expr"
2059+ },
2060+ "Some": {
2061+ "postfix": "some",
2062+ "body": "Some(${receiver})",
2063+ "description": "Wrap the expression in an `Option::Some`",
20632064 "scope": "expr"
20642065 },
20652066 "Err": {
@@ -2068,10 +2069,11 @@ impl Config {
20682069 "description": "Wrap the expression in a `Result::Err`",
20692070 "scope": "expr"
20702071 },
2071- "Some": {
2072- "postfix": "some",
2073- "body": "Some(${receiver})",
2074- "description": "Wrap the expression in an `Option::Some`",
2072+ "Rc::new": {
2073+ "postfix": "rc",
2074+ "body": "Rc::new(${receiver})",
2075+ "requires": "std::rc::Rc",
2076+ "description": "Put the expression into an `Rc`",
20752077 "scope": "expr"
20762078 }
20772079 }"# ,
@@ -3210,7 +3212,7 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
32103212 "FxHashMap<Box<str>, Box<[Box<str>]>>" => set ! {
32113213 "type" : "object" ,
32123214 } ,
3213- "FxHashMap <String, SnippetDef>" => set ! {
3215+ "FxIndexMap <String, SnippetDef>" => set ! {
32143216 "type" : "object" ,
32153217 } ,
32163218 "FxHashMap<String, String>" => set ! {
0 commit comments