@@ -41,6 +41,8 @@ use crate::{
41
41
lsp_ext:: { WorkspaceSymbolSearchKind , WorkspaceSymbolSearchScope } ,
42
42
} ;
43
43
44
+ type FxIndexMap < K , V > = indexmap:: IndexMap < K , V , rustc_hash:: FxBuildHasher > ;
45
+
44
46
mod patch_old_style;
45
47
46
48
// Conventions for configuration keys to preserve maximal extendability without breakage:
@@ -81,7 +83,7 @@ config_data! {
81
83
cachePriming_numThreads: NumThreads = NumThreads :: Physical ,
82
84
83
85
/// 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( ) ,
85
87
86
88
87
89
/// These paths (file/directories) will be ignored by rust-analyzer. They are
@@ -931,7 +933,7 @@ impl Config {
931
933
patch_old_style:: patch_json_for_outdated_configs ( & mut json) ;
932
934
933
935
let mut json_errors = vec ! [ ] ;
934
- let snips = get_field_json :: < FxHashMap < String , SnippetDef > > (
936
+ let snips = get_field_json :: < FxIndexMap < String , SnippetDef > > (
935
937
& mut json,
936
938
& mut json_errors,
937
939
"completion_snippets_custom" ,
@@ -2032,21 +2034,13 @@ impl Config {
2032
2034
* self . cfg_setTest ( source_root)
2033
2035
}
2034
2036
2035
- pub ( crate ) fn completion_snippets_default ( ) -> FxHashMap < String , SnippetDef > {
2037
+ pub ( crate ) fn completion_snippets_default ( ) -> FxIndexMap < String , SnippetDef > {
2036
2038
serde_json:: from_str (
2037
2039
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`",
2050
2044
"scope": "expr"
2051
2045
},
2052
2046
"Box::pin": {
@@ -2056,10 +2050,17 @@ impl Config {
2056
2050
"description": "Put the expression into a pinned `Box`",
2057
2051
"scope": "expr"
2058
2052
},
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`",
2063
2064
"scope": "expr"
2064
2065
},
2065
2066
"Err": {
@@ -2068,10 +2069,11 @@ impl Config {
2068
2069
"description": "Wrap the expression in a `Result::Err`",
2069
2070
"scope": "expr"
2070
2071
},
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`",
2075
2077
"scope": "expr"
2076
2078
}
2077
2079
}"# ,
@@ -3210,7 +3212,7 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
3210
3212
"FxHashMap<Box<str>, Box<[Box<str>]>>" => set ! {
3211
3213
"type" : "object" ,
3212
3214
} ,
3213
- "FxHashMap <String, SnippetDef>" => set ! {
3215
+ "FxIndexMap <String, SnippetDef>" => set ! {
3214
3216
"type" : "object" ,
3215
3217
} ,
3216
3218
"FxHashMap<String, String>" => set ! {
0 commit comments