Skip to content

Commit 7ab46b4

Browse files
committed
refactor: rename branches to branch_exit_points in highlight_related
1 parent 4373a5d commit 7ab46b4

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

src/tools/rust-analyzer/crates/ide/src/highlight_related.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub struct HighlightRelatedConfig {
3737
pub break_points: bool,
3838
pub closure_captures: bool,
3939
pub yield_points: bool,
40-
pub branches: bool,
40+
pub branch_exit_points: bool,
4141
}
4242

4343
type HighlightMap = FxHashMap<EditionedFileId, FxHashSet<HighlightedRange>>;
@@ -81,8 +81,8 @@ pub(crate) fn highlight_related(
8181
T![fn] | T![return] | T![->] if config.exit_points => {
8282
highlight_exit_points(sema, token).remove(&file_id)
8383
}
84-
T![match] | T![=>] | T![if] if config.branches => {
85-
highlight_branches(sema, token).remove(&file_id)
84+
T![match] | T![=>] | T![if] if config.branch_exit_points => {
85+
highlight_branch_exit_points(sema, token).remove(&file_id)
8686
}
8787
T![await] | T![async] if config.yield_points => {
8888
highlight_yield_points(sema, token).remove(&file_id)
@@ -306,7 +306,7 @@ fn highlight_references(
306306
if res.is_empty() { None } else { Some(res.into_iter().collect()) }
307307
}
308308

309-
pub(crate) fn highlight_branches(
309+
pub(crate) fn highlight_branch_exit_points(
310310
sema: &Semantics<'_, RootDatabase>,
311311
token: SyntaxToken,
312312
) -> FxHashMap<EditionedFileId, Vec<HighlightedRange>> {
@@ -871,7 +871,7 @@ mod tests {
871871
references: true,
872872
closure_captures: true,
873873
yield_points: true,
874-
branches: true,
874+
branch_exit_points: true,
875875
};
876876

877877
#[track_caller]
@@ -2298,7 +2298,7 @@ fn main() {
22982298

22992299
#[test]
23002300
fn no_branches_when_disabled() {
2301-
let config = HighlightRelatedConfig { branches: false, ..ENABLED_CONFIG };
2301+
let config = HighlightRelatedConfig { branch_exit_points: false, ..ENABLED_CONFIG };
23022302
check_with_config(
23032303
r#"
23042304
fn main() {

src/tools/rust-analyzer/crates/ide/src/references.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ fn handle_control_flow_keywords(
411411
T![for] if token.parent().and_then(ast::ForExpr::cast).is_some() => {
412412
highlight_related::highlight_break_points(sema, token)
413413
}
414-
T![if] | T![=>] | T![match] => highlight_related::highlight_branches(sema, token),
414+
T![if] | T![=>] | T![match] => highlight_related::highlight_branch_exit_points(sema, token),
415415
_ => return None,
416416
}
417417
.into_iter()

src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ config_data! {
9595

9696

9797
/// Enables highlighting of related return values while the cursor is on any `match`, `if`, or match arm arrow (`=>`).
98-
highlightRelated_branches_enable: bool = true,
98+
highlightRelated_branchExitPoints_enable: bool = true,
9999
/// Enables highlighting of related references while the cursor is on `break`, `loop`, `while`, or `for` keywords.
100100
highlightRelated_breakPoints_enable: bool = true,
101101
/// 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 {
16311631
exit_points: self.highlightRelated_exitPoints_enable().to_owned(),
16321632
yield_points: self.highlightRelated_yieldPoints_enable().to_owned(),
16331633
closure_captures: self.highlightRelated_closureCaptures_enable().to_owned(),
1634-
branches: self.highlightRelated_branches_enable().to_owned(),
1634+
branch_exit_points: self.highlightRelated_branchExitPoints_enable().to_owned(),
16351635
}
16361636
}
16371637

src/tools/rust-analyzer/docs/book/src/configuration_generated.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ Default: `"client"`
612612
Controls file watching implementation.
613613

614614

615-
## rust-analyzer.highlightRelated.branches.enable {#highlightRelated.branches.enable}
615+
## rust-analyzer.highlightRelated.branchExitPoints.enable {#highlightRelated.branchExitPoints.enable}
616616

617617
Default: `true`
618618

src/tools/rust-analyzer/editors/code/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@
15321532
{
15331533
"title": "highlightRelated",
15341534
"properties": {
1535-
"rust-analyzer.highlightRelated.branches.enable": {
1535+
"rust-analyzer.highlightRelated.branchExitPoints.enable": {
15361536
"markdownDescription": "Enables highlighting of related return values while the cursor is on any `match`, `if`, or match arm arrow (`=>`).",
15371537
"default": true,
15381538
"type": "boolean"

0 commit comments

Comments
 (0)