@@ -268,6 +268,41 @@ config_data! {
268268 /// Controls file watching implementation.
269269 files_watcher: FilesWatcherDef = FilesWatcherDef :: Client ,
270270
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 ) ,
271306
272307 /// Enables the experimental support for interpreting tests.
273308 interpret_tests: bool = false ,
@@ -466,42 +501,6 @@ config_data! {
466501 /// Enables highlighting of all break points for a loop or block context while the cursor is on any `async` or `await` keywords.
467502 highlightRelated_yieldPoints_enable: bool = true ,
468503
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-
505504 /// 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.
506505 imports_granularity_enforce: bool = false ,
507506 /// How imports should be grouped into use statements.
@@ -633,8 +632,8 @@ pub struct Config {
633632
634633 default_config : ConfigData ,
635634 client_config : ConfigInput ,
636- xdg_config : ConfigInput ,
637- ratoml_arena : FxHashMap < SourceRootId , RatomlNode > ,
635+ user_config : ConfigInput ,
636+ ratoml_files : FxHashMap < SourceRootId , RatomlNode > ,
638637}
639638
640639#[ derive( Clone , Debug ) ]
@@ -867,8 +866,8 @@ impl Config {
867866 workspace_roots,
868867 is_visual_studio_code,
869868 client_config : ConfigInput :: default ( ) ,
870- xdg_config : ConfigInput :: default ( ) ,
871- ratoml_arena : FxHashMap :: default ( ) ,
869+ user_config : ConfigInput :: default ( ) ,
870+ ratoml_files : FxHashMap :: default ( ) ,
872871 default_config : ConfigData :: default ( ) ,
873872 }
874873 }
@@ -905,8 +904,7 @@ impl Config {
905904 . map ( AbsPathBuf :: assert)
906905 . collect ( ) ;
907906 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) ;
910908 tracing:: debug!( "deserialized config data: {:#?}" , self . client_config) ;
911909 self . snippets . clear ( ) ;
912910
@@ -1051,36 +1049,32 @@ impl Config {
10511049 }
10521050 }
10531051
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 ( ) ;
10571054 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 ( ) ,
10641060 }
10651061 }
10661062
1067- pub fn hover ( & self , source_root : Option < SourceRootId > ) -> HoverConfig {
1063+ pub fn hover ( & self ) -> HoverConfig {
10681064 let mem_kind = |kind| match kind {
10691065 MemoryLayoutHoverRenderKindDef :: Both => MemoryLayoutHoverRenderKind :: Both ,
10701066 MemoryLayoutHoverRenderKindDef :: Decimal => MemoryLayoutHoverRenderKind :: Decimal ,
10711067 MemoryLayoutHoverRenderKindDef :: Hexadecimal => MemoryLayoutHoverRenderKind :: Hexadecimal ,
10721068 } ;
10731069 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 ( ) ,
10841078 format : {
10851079 let is_markdown = try_or_def ! ( self
10861080 . caps
@@ -1098,7 +1092,7 @@ impl Config {
10981092 HoverDocFormat :: PlainText
10991093 }
11001094 } ,
1101- keywords : self . hover_documentation_keywords_enable ( source_root ) . to_owned ( ) ,
1095+ keywords : self . hover_documentation_keywords_enable ( ) . to_owned ( ) ,
11021096 }
11031097 }
11041098
@@ -2196,7 +2190,7 @@ pub(crate) enum WorkspaceSymbolSearchKindDef {
21962190#[ derive( Serialize , Deserialize , Debug , Copy , Clone , PartialEq ) ]
21972191#[ serde( rename_all = "snake_case" ) ]
21982192#[ serde( untagged) ]
2199- enum MemoryLayoutHoverRenderKindDef {
2193+ pub ( crate ) enum MemoryLayoutHoverRenderKindDef {
22002194 #[ serde( with = "unit_v::decimal" ) ]
22012195 Decimal ,
22022196 #[ serde( with = "unit_v::hexadecimal" ) ]
@@ -2260,7 +2254,7 @@ macro_rules! _impl_for_config_data {
22602254 return & v;
22612255 }
22622256
2263- if let Some ( v) = self . xdg_config . local. $field. as_ref( ) {
2257+ if let Some ( v) = self . user_config . local. $field. as_ref( ) {
22642258 return & v;
22652259 }
22662260
@@ -2283,7 +2277,7 @@ macro_rules! _impl_for_config_data {
22832277 return & v;
22842278 }
22852279
2286- if let Some ( v) = self . xdg_config . global. $field. as_ref( ) {
2280+ if let Some ( v) = self . user_config . global. $field. as_ref( ) {
22872281 return & v;
22882282 }
22892283
@@ -2382,7 +2376,7 @@ macro_rules! _config_data {
23822376 }
23832377
23842378 impl $input {
2385- #[ allow( unused) ]
2379+ #[ allow( unused, clippy :: ptr_arg ) ]
23862380 fn from_json( json: & mut serde_json:: Value , error_sink: & mut Vec <( String , serde_json:: Error ) >) -> Self {
23872381 Self { $(
23882382 $field: get_field(
@@ -2394,7 +2388,7 @@ macro_rules! _config_data {
23942388 ) * }
23952389 }
23962390
2397- #[ allow( unused) ]
2391+ #[ allow( unused, clippy :: ptr_arg ) ]
23982392 fn from_toml( toml: & mut toml:: Table , error_sink: & mut Vec <( String , toml:: de:: Error ) >) -> Self {
23992393 Self { $(
24002394 $field: get_field_toml:: <$ty>(
0 commit comments