Skip to content

Commit ec3fb1c

Browse files
authored
Merge pull request #3853 from matklad/cf
Make control token modifier less ambiguous
2 parents 972816b + 48bc0ca commit ec3fb1c

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

crates/ra_ide/src/syntax_highlighting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ fn highlight_element(
232232
| T![loop]
233233
| T![match]
234234
| T![return]
235-
| T![while] => h | HighlightModifier::Control,
235+
| T![while] => h | HighlightModifier::ControlFlow,
236236
T![unsafe] => h | HighlightModifier::Unsafe,
237237
_ => h,
238238
}

crates/ra_ide/src/syntax_highlighting/tags.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub enum HighlightTag {
4444
#[repr(u8)]
4545
pub enum HighlightModifier {
4646
/// Used with keywords like `if` and `break`.
47-
Control = 0,
47+
ControlFlow = 0,
4848
/// `foo` in `fn foo(x: i32)` is a definition, `foo` in `foo(90 + 2)` is
4949
/// not.
5050
Definition,
@@ -91,15 +91,15 @@ impl fmt::Display for HighlightTag {
9191

9292
impl HighlightModifier {
9393
const ALL: &'static [HighlightModifier] = &[
94-
HighlightModifier::Control,
94+
HighlightModifier::ControlFlow,
9595
HighlightModifier::Definition,
9696
HighlightModifier::Mutable,
9797
HighlightModifier::Unsafe,
9898
];
9999

100100
fn as_str(self) -> &'static str {
101101
match self {
102-
HighlightModifier::Control => "control",
102+
HighlightModifier::ControlFlow => "control",
103103
HighlightModifier::Definition => "declaration",
104104
HighlightModifier::Mutable => "mutable",
105105
HighlightModifier::Unsafe => "unsafe",

crates/rust-analyzer/src/conv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use ra_vfs::LineEndings;
2020

2121
use crate::{
2222
req,
23-
semantic_tokens::{self, ModifierSet, CONSTANT, CONTROL, MUTABLE, UNSAFE},
23+
semantic_tokens::{self, ModifierSet, CONSTANT, CONTROL_FLOW, MUTABLE, UNSAFE},
2424
world::WorldSnapshot,
2525
Result,
2626
};
@@ -378,7 +378,7 @@ impl Conv for Highlight {
378378
for modifier in self.modifiers.iter() {
379379
let modifier = match modifier {
380380
HighlightModifier::Definition => SemanticTokenModifier::DECLARATION,
381-
HighlightModifier::Control => CONTROL,
381+
HighlightModifier::ControlFlow => CONTROL_FLOW,
382382
HighlightModifier::Mutable => MUTABLE,
383383
HighlightModifier::Unsafe => UNSAFE,
384384
};

crates/rust-analyzer/src/semantic_tokens.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub(crate) const TYPE_ALIAS: SemanticTokenType = SemanticTokenType::new("typeAli
1212
pub(crate) const UNION: SemanticTokenType = SemanticTokenType::new("union");
1313

1414
pub(crate) const CONSTANT: SemanticTokenModifier = SemanticTokenModifier::new("constant");
15-
pub(crate) const CONTROL: SemanticTokenModifier = SemanticTokenModifier::new("control");
15+
pub(crate) const CONTROL_FLOW: SemanticTokenModifier = SemanticTokenModifier::new("controlFlow");
1616
pub(crate) const MUTABLE: SemanticTokenModifier = SemanticTokenModifier::new("mutable");
1717
pub(crate) const UNSAFE: SemanticTokenModifier = SemanticTokenModifier::new("unsafe");
1818

@@ -56,7 +56,7 @@ pub(crate) const SUPPORTED_MODIFIERS: &[SemanticTokenModifier] = &[
5656
CONSTANT,
5757
MUTABLE,
5858
UNSAFE,
59-
CONTROL,
59+
CONTROL_FLOW,
6060
];
6161

6262
#[derive(Default)]

editors/code/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@
517517
"description": "Style for compile-time constants"
518518
},
519519
{
520-
"id": "control",
520+
"id": "controlFlow",
521521
"description": "Style for control flow keywords"
522522
},
523523
{
@@ -551,9 +551,6 @@
551551
"keyword.unsafe": [
552552
"keyword.other.unsafe"
553553
],
554-
"keyword.control": [
555-
"keyword.control"
556-
],
557554
"variable.constant": [
558555
"entity.name.constant"
559556
]

0 commit comments

Comments
 (0)