@@ -297,16 +297,6 @@ config_data! {
297
297
/// Controls file watching implementation.
298
298
files_watcher: FilesWatcherDef = "\" client\" " ,
299
299
300
- /// Enables highlighting of related references while the cursor is on `break`, `loop`, `while`, or `for` keywords.
301
- highlightRelated_breakPoints_enable: bool = "true" ,
302
- /// Enables highlighting of all captures of a closure while the cursor is on the `|` or move keyword of a closure.
303
- highlightRelated_closureCaptures_enable: bool = "true" ,
304
- /// Enables highlighting of all exit points while the cursor is on any `return`, `?`, `fn`, or return type arrow (`->`).
305
- highlightRelated_exitPoints_enable: bool = "true" ,
306
- /// Enables highlighting of related references while the cursor is on any identifier.
307
- highlightRelated_references_enable: bool = "true" ,
308
- /// Enables highlighting of all break points for a loop or block context while the cursor is on any `async` or `await` keywords.
309
- highlightRelated_yieldPoints_enable: bool = "true" ,
310
300
311
301
/// Whether to show `Debug` action. Only applies when
312
302
/// `#rust-analyzer.hover.actions.enable#` is set.
@@ -506,6 +496,16 @@ config_data! {
506
496
507
497
config_data ! {
508
498
struct LocalConfigData {
499
+ /// Enables highlighting of related references while the cursor is on `break`, `loop`, `while`, or `for` keywords.
500
+ highlightRelated_breakPoints_enable: bool = "true" ,
501
+ /// Enables highlighting of all captures of a closure while the cursor is on the `|` or move keyword of a closure.
502
+ highlightRelated_closureCaptures_enable: bool = "true" ,
503
+ /// Enables highlighting of all exit points while the cursor is on any `return`, `?`, `fn`, or return type arrow (`->`).
504
+ highlightRelated_exitPoints_enable: bool = "true" ,
505
+ /// Enables highlighting of related references while the cursor is on any identifier.
506
+ highlightRelated_references_enable: bool = "true" ,
507
+ /// Enables highlighting of all break points for a loop or block context while the cursor is on any `async` or `await` keywords.
508
+ highlightRelated_yieldPoints_enable: bool = "true" ,
509
509
510
510
/// Whether to show inlay type hints for binding modes.
511
511
inlayHints_bindingModeHints_enable: bool = "false" ,
@@ -670,6 +670,46 @@ pub struct LocalConfigView<'a> {
670
670
}
671
671
672
672
impl < ' a > LocalConfigView < ' a > {
673
+ pub fn assist ( & self ) -> AssistConfig {
674
+ AssistConfig {
675
+ snippet_cap : SnippetCap :: new ( self . experimental ( "snippetTextEdit" ) ) ,
676
+ allowed : None ,
677
+ insert_use : self . insert_use_config ( ) ,
678
+ prefer_no_std : self . local . imports_prefer_no_std ,
679
+ assist_emit_must_use : self . global . 0 . assist_emitMustUse ,
680
+ }
681
+ }
682
+
683
+ pub fn completion ( & self ) -> CompletionConfig {
684
+ CompletionConfig {
685
+ enable_postfix_completions : self . global . 0 . completion_postfix_enable ,
686
+ enable_imports_on_the_fly : self . global . 0 . completion_autoimport_enable
687
+ && completion_item_edit_resolve ( & self . caps ) ,
688
+ enable_self_on_the_fly : self . global . 0 . completion_autoself_enable ,
689
+ enable_private_editable : self . global . 0 . completion_privateEditable_enable ,
690
+ full_function_signatures : self . global . 0 . completion_fullFunctionSignatures_enable ,
691
+ callable : match self . global . 0 . completion_callable_snippets {
692
+ CallableCompletionDef :: FillArguments => Some ( CallableSnippets :: FillArguments ) ,
693
+ CallableCompletionDef :: AddParentheses => Some ( CallableSnippets :: AddParentheses ) ,
694
+ CallableCompletionDef :: None => None ,
695
+ } ,
696
+ insert_use : self . insert_use_config ( ) ,
697
+ prefer_no_std : self . local . imports_prefer_no_std ,
698
+ snippet_cap : SnippetCap :: new ( try_or_def ! (
699
+ self . caps
700
+ . text_document
701
+ . as_ref( ) ?
702
+ . completion
703
+ . as_ref( ) ?
704
+ . completion_item
705
+ . as_ref( ) ?
706
+ . snippet_support?
707
+ ) ) ,
708
+ snippets : self . snippets . clone ( ) . to_vec ( ) ,
709
+ limit : self . global . 0 . completion_limit ,
710
+ }
711
+ }
712
+
673
713
pub fn diagnostics ( & self ) -> DiagnosticsConfig {
674
714
DiagnosticsConfig {
675
715
enabled : self . global . 0 . diagnostics_enable ,
@@ -685,35 +725,24 @@ impl<'a> LocalConfigView<'a> {
685
725
prefer_no_std : self . local . imports_prefer_no_std ,
686
726
}
687
727
}
728
+ pub fn expand_proc_attr_macros ( & self ) -> bool {
729
+ self . global . 0 . procMacro_enable && self . global . 0 . procMacro_attributes_enable
730
+ }
688
731
689
- pub fn assist ( & self ) -> AssistConfig {
690
- AssistConfig {
691
- snippet_cap : SnippetCap :: new ( self . experimental ( "snippetTextEdit" ) ) ,
692
- allowed : None ,
693
- insert_use : self . insert_use_config ( ) ,
694
- prefer_no_std : self . local . imports_prefer_no_std ,
695
- assist_emit_must_use : self . global . 0 . assist_emitMustUse ,
696
- }
732
+ fn experimental ( & self , index : & ' static str ) -> bool {
733
+ try_or_def ! ( self . caps. experimental. as_ref( ) ?. get( index) ?. as_bool( ) ?)
697
734
}
698
735
699
- fn insert_use_config ( & self ) -> InsertUseConfig {
700
- InsertUseConfig {
701
- granularity : match self . local . imports_granularity_group {
702
- ImportGranularityDef :: Preserve => ImportGranularity :: Preserve ,
703
- ImportGranularityDef :: Item => ImportGranularity :: Item ,
704
- ImportGranularityDef :: Crate => ImportGranularity :: Crate ,
705
- ImportGranularityDef :: Module => ImportGranularity :: Module ,
706
- } ,
707
- enforce_granularity : self . local . imports_granularity_enforce ,
708
- prefix_kind : match self . local . imports_prefix {
709
- ImportPrefixDef :: Plain => PrefixKind :: Plain ,
710
- ImportPrefixDef :: ByCrate => PrefixKind :: ByCrate ,
711
- ImportPrefixDef :: BySelf => PrefixKind :: BySelf ,
712
- } ,
713
- group : self . local . imports_group_enable ,
714
- skip_glob_imports : !self . local . imports_merge_glob ,
736
+ pub fn highlight_related ( & self ) -> HighlightRelatedConfig {
737
+ HighlightRelatedConfig {
738
+ references : self . local . highlightRelated_references_enable ,
739
+ break_points : self . local . highlightRelated_breakPoints_enable ,
740
+ exit_points : self . local . highlightRelated_exitPoints_enable ,
741
+ yield_points : self . local . highlightRelated_yieldPoints_enable ,
742
+ closure_captures : self . local . highlightRelated_closureCaptures_enable ,
715
743
}
716
744
}
745
+
717
746
pub fn inlay_hints ( & self ) -> InlayHintsConfig {
718
747
let client_capability_fields = self
719
748
. caps
@@ -797,44 +826,25 @@ impl<'a> LocalConfigView<'a> {
797
826
}
798
827
}
799
828
800
- pub fn expand_proc_attr_macros ( & self ) -> bool {
801
- self . global . 0 . procMacro_enable && self . global . 0 . procMacro_attributes_enable
802
- }
803
-
804
- pub fn completion ( & self ) -> CompletionConfig {
805
- CompletionConfig {
806
- enable_postfix_completions : self . global . 0 . completion_postfix_enable ,
807
- enable_imports_on_the_fly : self . global . 0 . completion_autoimport_enable
808
- && completion_item_edit_resolve ( & self . caps ) ,
809
- enable_self_on_the_fly : self . global . 0 . completion_autoself_enable ,
810
- enable_private_editable : self . global . 0 . completion_privateEditable_enable ,
811
- full_function_signatures : self . global . 0 . completion_fullFunctionSignatures_enable ,
812
- callable : match self . global . 0 . completion_callable_snippets {
813
- CallableCompletionDef :: FillArguments => Some ( CallableSnippets :: FillArguments ) ,
814
- CallableCompletionDef :: AddParentheses => Some ( CallableSnippets :: AddParentheses ) ,
815
- CallableCompletionDef :: None => None ,
829
+ fn insert_use_config ( & self ) -> InsertUseConfig {
830
+ InsertUseConfig {
831
+ granularity : match self . local . imports_granularity_group {
832
+ ImportGranularityDef :: Preserve => ImportGranularity :: Preserve ,
833
+ ImportGranularityDef :: Item => ImportGranularity :: Item ,
834
+ ImportGranularityDef :: Crate => ImportGranularity :: Crate ,
835
+ ImportGranularityDef :: Module => ImportGranularity :: Module ,
816
836
} ,
817
- insert_use : self . insert_use_config ( ) ,
818
- prefer_no_std : self . local . imports_prefer_no_std ,
819
- snippet_cap : SnippetCap :: new ( try_or_def ! (
820
- self . caps
821
- . text_document
822
- . as_ref( ) ?
823
- . completion
824
- . as_ref( ) ?
825
- . completion_item
826
- . as_ref( ) ?
827
- . snippet_support?
828
- ) ) ,
829
- snippets : self . snippets . clone ( ) . to_vec ( ) ,
830
- limit : self . global . 0 . completion_limit ,
837
+ enforce_granularity : self . local . imports_granularity_enforce ,
838
+ prefix_kind : match self . local . imports_prefix {
839
+ ImportPrefixDef :: Plain => PrefixKind :: Plain ,
840
+ ImportPrefixDef :: ByCrate => PrefixKind :: ByCrate ,
841
+ ImportPrefixDef :: BySelf => PrefixKind :: BySelf ,
842
+ } ,
843
+ group : self . local . imports_group_enable ,
844
+ skip_glob_imports : !self . local . imports_merge_glob ,
831
845
}
832
846
}
833
847
834
- fn experimental ( & self , index : & ' static str ) -> bool {
835
- try_or_def ! ( self . caps. experimental. as_ref( ) ?. get( index) ?. as_bool( ) ?)
836
- }
837
-
838
848
pub fn join_lines ( & self ) -> JoinLinesConfig {
839
849
JoinLinesConfig {
840
850
join_else_if : self . local . joinLines_joinElseIf ,
@@ -1876,16 +1886,6 @@ impl Config {
1876
1886
}
1877
1887
}
1878
1888
1879
- pub fn highlight_related ( & self ) -> HighlightRelatedConfig {
1880
- HighlightRelatedConfig {
1881
- references : self . root_config . global . 0 . highlightRelated_references_enable ,
1882
- break_points : self . root_config . global . 0 . highlightRelated_breakPoints_enable ,
1883
- exit_points : self . root_config . global . 0 . highlightRelated_exitPoints_enable ,
1884
- yield_points : self . root_config . global . 0 . highlightRelated_yieldPoints_enable ,
1885
- closure_captures : self . root_config . global . 0 . highlightRelated_closureCaptures_enable ,
1886
- }
1887
- }
1888
-
1889
1889
pub fn prime_caches_num_threads ( & self ) -> u8 {
1890
1890
match self . root_config . global . 0 . cachePriming_numThreads {
1891
1891
0 => num_cpus:: get_physical ( ) . try_into ( ) . unwrap_or ( u8:: MAX ) ,
0 commit comments