diff options
author | Aleksey Kladov <[email protected]> | 2020-04-06 10:53:56 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-06 10:53:56 +0100 |
commit | ec3fb1cdb4f1808a11fb6057550ed721c2aa36a9 (patch) | |
tree | b729d8ec3a32fae92a209d1bed4e97899dfb2433 | |
parent | 972816b6d4b8caf1b37820e9f9331552db70a04f (diff) | |
parent | 48bc0ca745a0ebdd61b7db3935582bf5ec95042b (diff) |
Merge pull request #3853 from matklad/cf
Make control token modifier less ambiguous
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting/tags.rs | 6 | ||||
-rw-r--r-- | crates/rust-analyzer/src/conv.rs | 4 | ||||
-rw-r--r-- | crates/rust-analyzer/src/semantic_tokens.rs | 4 | ||||
-rw-r--r-- | editors/code/package.json | 5 |
5 files changed, 9 insertions, 12 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 7fc94d3cd..d833a816b 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -232,7 +232,7 @@ fn highlight_element( | |||
232 | | T![loop] | 232 | | T![loop] |
233 | | T![match] | 233 | | T![match] |
234 | | T![return] | 234 | | T![return] |
235 | | T![while] => h | HighlightModifier::Control, | 235 | | T![while] => h | HighlightModifier::ControlFlow, |
236 | T![unsafe] => h | HighlightModifier::Unsafe, | 236 | T![unsafe] => h | HighlightModifier::Unsafe, |
237 | _ => h, | 237 | _ => h, |
238 | } | 238 | } |
diff --git a/crates/ra_ide/src/syntax_highlighting/tags.rs b/crates/ra_ide/src/syntax_highlighting/tags.rs index 8835a5de2..e8b138e1a 100644 --- a/crates/ra_ide/src/syntax_highlighting/tags.rs +++ b/crates/ra_ide/src/syntax_highlighting/tags.rs | |||
@@ -44,7 +44,7 @@ pub enum HighlightTag { | |||
44 | #[repr(u8)] | 44 | #[repr(u8)] |
45 | pub enum HighlightModifier { | 45 | pub enum HighlightModifier { |
46 | /// Used with keywords like `if` and `break`. | 46 | /// Used with keywords like `if` and `break`. |
47 | Control = 0, | 47 | ControlFlow = 0, |
48 | /// `foo` in `fn foo(x: i32)` is a definition, `foo` in `foo(90 + 2)` is | 48 | /// `foo` in `fn foo(x: i32)` is a definition, `foo` in `foo(90 + 2)` is |
49 | /// not. | 49 | /// not. |
50 | Definition, | 50 | Definition, |
@@ -91,7 +91,7 @@ impl fmt::Display for HighlightTag { | |||
91 | 91 | ||
92 | impl HighlightModifier { | 92 | impl HighlightModifier { |
93 | const ALL: &'static [HighlightModifier] = &[ | 93 | const ALL: &'static [HighlightModifier] = &[ |
94 | HighlightModifier::Control, | 94 | HighlightModifier::ControlFlow, |
95 | HighlightModifier::Definition, | 95 | HighlightModifier::Definition, |
96 | HighlightModifier::Mutable, | 96 | HighlightModifier::Mutable, |
97 | HighlightModifier::Unsafe, | 97 | HighlightModifier::Unsafe, |
@@ -99,7 +99,7 @@ impl HighlightModifier { | |||
99 | 99 | ||
100 | fn as_str(self) -> &'static str { | 100 | fn as_str(self) -> &'static str { |
101 | match self { | 101 | match self { |
102 | HighlightModifier::Control => "control", | 102 | HighlightModifier::ControlFlow => "control", |
103 | HighlightModifier::Definition => "declaration", | 103 | HighlightModifier::Definition => "declaration", |
104 | HighlightModifier::Mutable => "mutable", | 104 | HighlightModifier::Mutable => "mutable", |
105 | HighlightModifier::Unsafe => "unsafe", | 105 | HighlightModifier::Unsafe => "unsafe", |
diff --git a/crates/rust-analyzer/src/conv.rs b/crates/rust-analyzer/src/conv.rs index 57c4c8ce5..b2b1cb625 100644 --- a/crates/rust-analyzer/src/conv.rs +++ b/crates/rust-analyzer/src/conv.rs | |||
@@ -20,7 +20,7 @@ use ra_vfs::LineEndings; | |||
20 | 20 | ||
21 | use crate::{ | 21 | use crate::{ |
22 | req, | 22 | req, |
23 | semantic_tokens::{self, ModifierSet, CONSTANT, CONTROL, MUTABLE, UNSAFE}, | 23 | semantic_tokens::{self, ModifierSet, CONSTANT, CONTROL_FLOW, MUTABLE, UNSAFE}, |
24 | world::WorldSnapshot, | 24 | world::WorldSnapshot, |
25 | Result, | 25 | Result, |
26 | }; | 26 | }; |
@@ -378,7 +378,7 @@ impl Conv for Highlight { | |||
378 | for modifier in self.modifiers.iter() { | 378 | for modifier in self.modifiers.iter() { |
379 | let modifier = match modifier { | 379 | let modifier = match modifier { |
380 | HighlightModifier::Definition => SemanticTokenModifier::DECLARATION, | 380 | HighlightModifier::Definition => SemanticTokenModifier::DECLARATION, |
381 | HighlightModifier::Control => CONTROL, | 381 | HighlightModifier::ControlFlow => CONTROL_FLOW, |
382 | HighlightModifier::Mutable => MUTABLE, | 382 | HighlightModifier::Mutable => MUTABLE, |
383 | HighlightModifier::Unsafe => UNSAFE, | 383 | HighlightModifier::Unsafe => UNSAFE, |
384 | }; | 384 | }; |
diff --git a/crates/rust-analyzer/src/semantic_tokens.rs b/crates/rust-analyzer/src/semantic_tokens.rs index 2a66bbfd8..865fa3b1c 100644 --- a/crates/rust-analyzer/src/semantic_tokens.rs +++ b/crates/rust-analyzer/src/semantic_tokens.rs | |||
@@ -12,7 +12,7 @@ pub(crate) const TYPE_ALIAS: SemanticTokenType = SemanticTokenType::new("typeAli | |||
12 | pub(crate) const UNION: SemanticTokenType = SemanticTokenType::new("union"); | 12 | pub(crate) const UNION: SemanticTokenType = SemanticTokenType::new("union"); |
13 | 13 | ||
14 | pub(crate) const CONSTANT: SemanticTokenModifier = SemanticTokenModifier::new("constant"); | 14 | 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"); |
16 | pub(crate) const MUTABLE: SemanticTokenModifier = SemanticTokenModifier::new("mutable"); | 16 | pub(crate) const MUTABLE: SemanticTokenModifier = SemanticTokenModifier::new("mutable"); |
17 | pub(crate) const UNSAFE: SemanticTokenModifier = SemanticTokenModifier::new("unsafe"); | 17 | pub(crate) const UNSAFE: SemanticTokenModifier = SemanticTokenModifier::new("unsafe"); |
18 | 18 | ||
@@ -56,7 +56,7 @@ pub(crate) const SUPPORTED_MODIFIERS: &[SemanticTokenModifier] = &[ | |||
56 | CONSTANT, | 56 | CONSTANT, |
57 | MUTABLE, | 57 | MUTABLE, |
58 | UNSAFE, | 58 | UNSAFE, |
59 | CONTROL, | 59 | CONTROL_FLOW, |
60 | ]; | 60 | ]; |
61 | 61 | ||
62 | #[derive(Default)] | 62 | #[derive(Default)] |
diff --git a/editors/code/package.json b/editors/code/package.json index f0d5127d4..60ca0c69c 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -517,7 +517,7 @@ | |||
517 | "description": "Style for compile-time constants" | 517 | "description": "Style for compile-time constants" |
518 | }, | 518 | }, |
519 | { | 519 | { |
520 | "id": "control", | 520 | "id": "controlFlow", |
521 | "description": "Style for control flow keywords" | 521 | "description": "Style for control flow keywords" |
522 | }, | 522 | }, |
523 | { | 523 | { |
@@ -551,9 +551,6 @@ | |||
551 | "keyword.unsafe": [ | 551 | "keyword.unsafe": [ |
552 | "keyword.other.unsafe" | 552 | "keyword.other.unsafe" |
553 | ], | 553 | ], |
554 | "keyword.control": [ | ||
555 | "keyword.control" | ||
556 | ], | ||
557 | "variable.constant": [ | 554 | "variable.constant": [ |
558 | "entity.name.constant" | 555 | "entity.name.constant" |
559 | ] | 556 | ] |