mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-07-07 21:25:37 +00:00
refactor: rename branches
to branch_exit_points
in highlight_related
This commit is contained in:
parent
9fa0543504
commit
c36758def4
5 changed files with 11 additions and 11 deletions
|
@ -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<EditionedFileId, FxHashSet<HighlightedRange>>;
|
||||
|
@ -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<EditionedFileId, Vec<HighlightedRange>> {
|
||||
|
@ -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() {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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`
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue