@@ -268,6 +268,41 @@ config_data! {
268
268
/// Controls file watching implementation.
269
269
files_watcher: FilesWatcherDef = FilesWatcherDef :: Client ,
270
270
271
+ /// Whether to show `Debug` action. Only applies when
272
+ /// `#rust-analyzer.hover.actions.enable#` is set.
273
+ hover_actions_debug_enable: bool = true ,
274
+ /// Whether to show HoverActions in Rust files.
275
+ hover_actions_enable: bool = true ,
276
+ /// Whether to show `Go to Type Definition` action. Only applies when
277
+ /// `#rust-analyzer.hover.actions.enable#` is set.
278
+ hover_actions_gotoTypeDef_enable: bool = true ,
279
+ /// Whether to show `Implementations` action. Only applies when
280
+ /// `#rust-analyzer.hover.actions.enable#` is set.
281
+ hover_actions_implementations_enable: bool = true ,
282
+ /// Whether to show `References` action. Only applies when
283
+ /// `#rust-analyzer.hover.actions.enable#` is set.
284
+ hover_actions_references_enable: bool = false ,
285
+ /// Whether to show `Run` action. Only applies when
286
+ /// `#rust-analyzer.hover.actions.enable#` is set.
287
+ hover_actions_run_enable: bool = true ,
288
+
289
+ /// Whether to show documentation on hover.
290
+ hover_documentation_enable: bool = true ,
291
+ /// Whether to show keyword hover popups. Only applies when
292
+ /// `#rust-analyzer.hover.documentation.enable#` is set.
293
+ hover_documentation_keywords_enable: bool = true ,
294
+ /// Use markdown syntax for links on hover.
295
+ hover_links_enable: bool = true ,
296
+ /// How to render the align information in a memory layout hover.
297
+ hover_memoryLayout_alignment: Option <MemoryLayoutHoverRenderKindDef > = Some ( MemoryLayoutHoverRenderKindDef :: Hexadecimal ) ,
298
+ /// Whether to show memory layout data on hover.
299
+ hover_memoryLayout_enable: bool = true ,
300
+ /// How to render the niche information in a memory layout hover.
301
+ hover_memoryLayout_niches: Option <bool > = Some ( false ) ,
302
+ /// How to render the offset information in a memory layout hover.
303
+ hover_memoryLayout_offset: Option <MemoryLayoutHoverRenderKindDef > = Some ( MemoryLayoutHoverRenderKindDef :: Hexadecimal ) ,
304
+ /// How to render the size information in a memory layout hover.
305
+ hover_memoryLayout_size: Option <MemoryLayoutHoverRenderKindDef > = Some ( MemoryLayoutHoverRenderKindDef :: Both ) ,
271
306
272
307
/// Enables the experimental support for interpreting tests.
273
308
interpret_tests: bool = false ,
@@ -466,42 +501,6 @@ config_data! {
466
501
/// Enables highlighting of all break points for a loop or block context while the cursor is on any `async` or `await` keywords.
467
502
highlightRelated_yieldPoints_enable: bool = true ,
468
503
469
- /// Whether to show `Debug` action. Only applies when
470
- /// `#rust-analyzer.hover.actions.enable#` is set.
471
- hover_actions_debug_enable: bool = true ,
472
- /// Whether to show HoverActions in Rust files.
473
- hover_actions_enable: bool = true ,
474
- /// Whether to show `Go to Type Definition` action. Only applies when
475
- /// `#rust-analyzer.hover.actions.enable#` is set.
476
- hover_actions_gotoTypeDef_enable: bool = true ,
477
- /// Whether to show `Implementations` action. Only applies when
478
- /// `#rust-analyzer.hover.actions.enable#` is set.
479
- hover_actions_implementations_enable: bool = true ,
480
- /// Whether to show `References` action. Only applies when
481
- /// `#rust-analyzer.hover.actions.enable#` is set.
482
- hover_actions_references_enable: bool = false ,
483
- /// Whether to show `Run` action. Only applies when
484
- /// `#rust-analyzer.hover.actions.enable#` is set.
485
- hover_actions_run_enable: bool = true ,
486
-
487
- /// Whether to show documentation on hover.
488
- hover_documentation_enable: bool = true ,
489
- /// Whether to show keyword hover popups. Only applies when
490
- /// `#rust-analyzer.hover.documentation.enable#` is set.
491
- hover_documentation_keywords_enable: bool = true ,
492
- /// Use markdown syntax for links on hover.
493
- hover_links_enable: bool = true ,
494
- /// How to render the align information in a memory layout hover.
495
- hover_memoryLayout_alignment: Option <MemoryLayoutHoverRenderKindDef > = Some ( MemoryLayoutHoverRenderKindDef :: Hexadecimal ) ,
496
- /// Whether to show memory layout data on hover.
497
- hover_memoryLayout_enable: bool = true ,
498
- /// How to render the niche information in a memory layout hover.
499
- hover_memoryLayout_niches: Option <bool > = Some ( false ) ,
500
- /// How to render the offset information in a memory layout hover.
501
- hover_memoryLayout_offset: Option <MemoryLayoutHoverRenderKindDef > = Some ( MemoryLayoutHoverRenderKindDef :: Hexadecimal ) ,
502
- /// How to render the size information in a memory layout hover.
503
- hover_memoryLayout_size: Option <MemoryLayoutHoverRenderKindDef > = Some ( MemoryLayoutHoverRenderKindDef :: Both ) ,
504
-
505
504
/// Whether to enforce the import granularity setting for all files. If set to false rust-analyzer will try to keep import styles consistent per file.
506
505
imports_granularity_enforce: bool = false ,
507
506
/// How imports should be grouped into use statements.
@@ -633,8 +632,8 @@ pub struct Config {
633
632
634
633
default_config : ConfigData ,
635
634
client_config : ConfigInput ,
636
- xdg_config : ConfigInput ,
637
- ratoml_arena : FxHashMap < SourceRootId , RatomlNode > ,
635
+ user_config : ConfigInput ,
636
+ ratoml_files : FxHashMap < SourceRootId , RatomlNode > ,
638
637
}
639
638
640
639
#[ derive( Clone , Debug ) ]
@@ -867,8 +866,8 @@ impl Config {
867
866
workspace_roots,
868
867
is_visual_studio_code,
869
868
client_config : ConfigInput :: default ( ) ,
870
- xdg_config : ConfigInput :: default ( ) ,
871
- ratoml_arena : FxHashMap :: default ( ) ,
869
+ user_config : ConfigInput :: default ( ) ,
870
+ ratoml_files : FxHashMap :: default ( ) ,
872
871
default_config : ConfigData :: default ( ) ,
873
872
}
874
873
}
@@ -905,8 +904,7 @@ impl Config {
905
904
. map ( AbsPathBuf :: assert)
906
905
. collect ( ) ;
907
906
patch_old_style:: patch_json_for_outdated_configs ( & mut json) ;
908
- let input = ConfigInput :: from_json ( json, & mut errors) ;
909
- self . client_config = input;
907
+ self . client_config = ConfigInput :: from_json ( json, & mut errors) ;
910
908
tracing:: debug!( "deserialized config data: {:#?}" , self . client_config) ;
911
909
self . snippets . clear ( ) ;
912
910
@@ -1051,36 +1049,32 @@ impl Config {
1051
1049
}
1052
1050
}
1053
1051
1054
- pub fn hover_actions ( & self , source_root : Option < SourceRootId > ) -> HoverActionsConfig {
1055
- let enable =
1056
- self . experimental ( "hoverActions" ) && self . hover_actions_enable ( source_root) . to_owned ( ) ;
1052
+ pub fn hover_actions ( & self ) -> HoverActionsConfig {
1053
+ let enable = self . experimental ( "hoverActions" ) && self . hover_actions_enable ( ) . to_owned ( ) ;
1057
1054
HoverActionsConfig {
1058
- implementations : enable
1059
- && self . hover_actions_implementations_enable ( source_root) . to_owned ( ) ,
1060
- references : enable && self . hover_actions_references_enable ( source_root) . to_owned ( ) ,
1061
- run : enable && self . hover_actions_run_enable ( source_root) . to_owned ( ) ,
1062
- debug : enable && self . hover_actions_debug_enable ( source_root) . to_owned ( ) ,
1063
- goto_type_def : enable && self . hover_actions_gotoTypeDef_enable ( source_root) . to_owned ( ) ,
1055
+ implementations : enable && self . hover_actions_implementations_enable ( ) . to_owned ( ) ,
1056
+ references : enable && self . hover_actions_references_enable ( ) . to_owned ( ) ,
1057
+ run : enable && self . hover_actions_run_enable ( ) . to_owned ( ) ,
1058
+ debug : enable && self . hover_actions_debug_enable ( ) . to_owned ( ) ,
1059
+ goto_type_def : enable && self . hover_actions_gotoTypeDef_enable ( ) . to_owned ( ) ,
1064
1060
}
1065
1061
}
1066
1062
1067
- pub fn hover ( & self , source_root : Option < SourceRootId > ) -> HoverConfig {
1063
+ pub fn hover ( & self ) -> HoverConfig {
1068
1064
let mem_kind = |kind| match kind {
1069
1065
MemoryLayoutHoverRenderKindDef :: Both => MemoryLayoutHoverRenderKind :: Both ,
1070
1066
MemoryLayoutHoverRenderKindDef :: Decimal => MemoryLayoutHoverRenderKind :: Decimal ,
1071
1067
MemoryLayoutHoverRenderKindDef :: Hexadecimal => MemoryLayoutHoverRenderKind :: Hexadecimal ,
1072
1068
} ;
1073
1069
HoverConfig {
1074
- links_in_hover : self . hover_links_enable ( source_root) . to_owned ( ) ,
1075
- memory_layout : self . hover_memoryLayout_enable ( source_root) . then_some (
1076
- MemoryLayoutHoverConfig {
1077
- size : self . hover_memoryLayout_size ( source_root) . map ( mem_kind) ,
1078
- offset : self . hover_memoryLayout_offset ( source_root) . map ( mem_kind) ,
1079
- alignment : self . hover_memoryLayout_alignment ( source_root) . map ( mem_kind) ,
1080
- niches : self . hover_memoryLayout_niches ( source_root) . unwrap_or_default ( ) ,
1081
- } ,
1082
- ) ,
1083
- documentation : self . hover_documentation_enable ( source_root) . to_owned ( ) ,
1070
+ links_in_hover : self . hover_links_enable ( ) . to_owned ( ) ,
1071
+ memory_layout : self . hover_memoryLayout_enable ( ) . then_some ( MemoryLayoutHoverConfig {
1072
+ size : self . hover_memoryLayout_size ( ) . map ( mem_kind) ,
1073
+ offset : self . hover_memoryLayout_offset ( ) . map ( mem_kind) ,
1074
+ alignment : self . hover_memoryLayout_alignment ( ) . map ( mem_kind) ,
1075
+ niches : self . hover_memoryLayout_niches ( ) . unwrap_or_default ( ) ,
1076
+ } ) ,
1077
+ documentation : self . hover_documentation_enable ( ) . to_owned ( ) ,
1084
1078
format : {
1085
1079
let is_markdown = try_or_def ! ( self
1086
1080
. caps
@@ -1098,7 +1092,7 @@ impl Config {
1098
1092
HoverDocFormat :: PlainText
1099
1093
}
1100
1094
} ,
1101
- keywords : self . hover_documentation_keywords_enable ( source_root ) . to_owned ( ) ,
1095
+ keywords : self . hover_documentation_keywords_enable ( ) . to_owned ( ) ,
1102
1096
}
1103
1097
}
1104
1098
@@ -2196,7 +2190,7 @@ pub(crate) enum WorkspaceSymbolSearchKindDef {
2196
2190
#[ derive( Serialize , Deserialize , Debug , Copy , Clone , PartialEq ) ]
2197
2191
#[ serde( rename_all = "snake_case" ) ]
2198
2192
#[ serde( untagged) ]
2199
- enum MemoryLayoutHoverRenderKindDef {
2193
+ pub ( crate ) enum MemoryLayoutHoverRenderKindDef {
2200
2194
#[ serde( with = "unit_v::decimal" ) ]
2201
2195
Decimal ,
2202
2196
#[ serde( with = "unit_v::hexadecimal" ) ]
@@ -2260,7 +2254,7 @@ macro_rules! _impl_for_config_data {
2260
2254
return & v;
2261
2255
}
2262
2256
2263
- if let Some ( v) = self . xdg_config . local. $field. as_ref( ) {
2257
+ if let Some ( v) = self . user_config . local. $field. as_ref( ) {
2264
2258
return & v;
2265
2259
}
2266
2260
@@ -2283,7 +2277,7 @@ macro_rules! _impl_for_config_data {
2283
2277
return & v;
2284
2278
}
2285
2279
2286
- if let Some ( v) = self . xdg_config . global. $field. as_ref( ) {
2280
+ if let Some ( v) = self . user_config . global. $field. as_ref( ) {
2287
2281
return & v;
2288
2282
}
2289
2283
@@ -2382,7 +2376,7 @@ macro_rules! _config_data {
2382
2376
}
2383
2377
2384
2378
impl $input {
2385
- #[ allow( unused) ]
2379
+ #[ allow( unused, clippy :: ptr_arg ) ]
2386
2380
fn from_json( json: & mut serde_json:: Value , error_sink: & mut Vec <( String , serde_json:: Error ) >) -> Self {
2387
2381
Self { $(
2388
2382
$field: get_field(
@@ -2394,7 +2388,7 @@ macro_rules! _config_data {
2394
2388
) * }
2395
2389
}
2396
2390
2397
- #[ allow( unused) ]
2391
+ #[ allow( unused, clippy :: ptr_arg ) ]
2398
2392
fn from_toml( toml: & mut toml:: Table , error_sink: & mut Vec <( String , toml:: de:: Error ) >) -> Self {
2399
2393
Self { $(
2400
2394
$field: get_field_toml:: <$ty>(
0 commit comments