diff --git a/src/tools/rust-analyzer/crates/ide/src/highlight_related.rs b/src/tools/rust-analyzer/crates/ide/src/highlight_related.rs index 28447005c1ff..77b8599fd021 100644 --- a/src/tools/rust-analyzer/crates/ide/src/highlight_related.rs +++ b/src/tools/rust-analyzer/crates/ide/src/highlight_related.rs @@ -37,7 +37,7 @@ pub struct HighlightRelatedConfig { pub break_points: bool, pub closure_captures: bool, pub yield_points: bool, - pub branches: bool, + pub branch_exit_points: bool, } type HighlightMap = FxHashMap>; @@ -81,8 +81,8 @@ pub(crate) fn highlight_related( T![fn] | T![return] | T![->] if config.exit_points => { highlight_exit_points(sema, token).remove(&file_id) } - T![match] | T![=>] | T![if] if config.branches => { - highlight_branches(sema, token).remove(&file_id) + T![match] | T![=>] | T![if] if config.branch_exit_points => { + highlight_branch_exit_points(sema, token).remove(&file_id) } T![await] | T![async] if config.yield_points => { highlight_yield_points(sema, token).remove(&file_id) @@ -306,7 +306,7 @@ fn highlight_references( if res.is_empty() { None } else { Some(res.into_iter().collect()) } } -pub(crate) fn highlight_branches( +pub(crate) fn highlight_branch_exit_points( sema: &Semantics<'_, RootDatabase>, token: SyntaxToken, ) -> FxHashMap> { @@ -871,7 +871,7 @@ mod tests { references: true, closure_captures: true, yield_points: true, - branches: true, + branch_exit_points: true, }; #[track_caller] @@ -2298,7 +2298,7 @@ fn main() { #[test] fn no_branches_when_disabled() { - let config = HighlightRelatedConfig { branches: false, ..ENABLED_CONFIG }; + let config = HighlightRelatedConfig { branch_exit_points: false, ..ENABLED_CONFIG }; check_with_config( r#" fn main() { diff --git a/src/tools/rust-analyzer/crates/ide/src/references.rs b/src/tools/rust-analyzer/crates/ide/src/references.rs index 900f49910d3a..205e93d7a24c 100644 --- a/src/tools/rust-analyzer/crates/ide/src/references.rs +++ b/src/tools/rust-analyzer/crates/ide/src/references.rs @@ -411,7 +411,7 @@ fn handle_control_flow_keywords( T![for] if token.parent().and_then(ast::ForExpr::cast).is_some() => { highlight_related::highlight_break_points(sema, token) } - T![if] | T![=>] | T![match] => highlight_related::highlight_branches(sema, token), + T![if] | T![=>] | T![match] => highlight_related::highlight_branch_exit_points(sema, token), _ => return None, } .into_iter() diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs index cc8711f2c08d..e716d1407522 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs @@ -95,7 +95,7 @@ config_data! { /// Enables highlighting of related return values while the cursor is on any `match`, `if`, or match arm arrow (`=>`). - highlightRelated_branches_enable: bool = true, + highlightRelated_branchExitPoints_enable: bool = true, /// Enables highlighting of related references while the cursor is on `break`, `loop`, `while`, or `for` keywords. highlightRelated_breakPoints_enable: bool = true, /// Enables highlighting of all captures of a closure while the cursor is on the `|` or move keyword of a closure. @@ -1631,7 +1631,7 @@ impl Config { exit_points: self.highlightRelated_exitPoints_enable().to_owned(), yield_points: self.highlightRelated_yieldPoints_enable().to_owned(), closure_captures: self.highlightRelated_closureCaptures_enable().to_owned(), - branches: self.highlightRelated_branches_enable().to_owned(), + branch_exit_points: self.highlightRelated_branchExitPoints_enable().to_owned(), } } diff --git a/src/tools/rust-analyzer/docs/book/src/configuration_generated.md b/src/tools/rust-analyzer/docs/book/src/configuration_generated.md index 587c09234c13..ebac26e1d60a 100644 --- a/src/tools/rust-analyzer/docs/book/src/configuration_generated.md +++ b/src/tools/rust-analyzer/docs/book/src/configuration_generated.md @@ -612,7 +612,7 @@ Default: `"client"` Controls file watching implementation. -## rust-analyzer.highlightRelated.branches.enable {#highlightRelated.branches.enable} +## rust-analyzer.highlightRelated.branchExitPoints.enable {#highlightRelated.branchExitPoints.enable} Default: `true` diff --git a/src/tools/rust-analyzer/editors/code/package.json b/src/tools/rust-analyzer/editors/code/package.json index c792ef0ffdc2..3cb4c21ee1fb 100644 --- a/src/tools/rust-analyzer/editors/code/package.json +++ b/src/tools/rust-analyzer/editors/code/package.json @@ -1532,7 +1532,7 @@ { "title": "highlightRelated", "properties": { - "rust-analyzer.highlightRelated.branches.enable": { + "rust-analyzer.highlightRelated.branchExitPoints.enable": { "markdownDescription": "Enables highlighting of related return values while the cursor is on any `match`, `if`, or match arm arrow (`=>`).", "default": true, "type": "boolean"