diff options
author | Lukas Wirth <[email protected]> | 2021-04-23 15:43:48 +0100 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-04-23 16:24:45 +0100 |
commit | c005ce60a048a5df79b93ce45911ab0c6952a41b (patch) | |
tree | 0f82a955e84e10bbf4e0faebf7a16928dec7c7a4 /crates | |
parent | 85bab7539a050bb2c0eeae93b029ebde2aa48668 (diff) |
Tag `yield` and `await` as ControlFlow in semantic highlighting
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ide/src/syntax_highlighting/highlight.rs | 6 | ||||
-rw-r--r-- | crates/ide/src/syntax_highlighting/tags.rs | 12 |
2 files changed, 13 insertions, 5 deletions
diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs index 18552459b..62213dc47 100644 --- a/crates/ide/src/syntax_highlighting/highlight.rs +++ b/crates/ide/src/syntax_highlighting/highlight.rs | |||
@@ -254,15 +254,17 @@ pub(super) fn element( | |||
254 | k if k.is_keyword() => { | 254 | k if k.is_keyword() => { |
255 | let h = Highlight::new(HlTag::Keyword); | 255 | let h = Highlight::new(HlTag::Keyword); |
256 | match k { | 256 | match k { |
257 | T![break] | 257 | T![await] |
258 | | T![break] | ||
258 | | T![continue] | 259 | | T![continue] |
259 | | T![else] | 260 | | T![else] |
260 | | T![if] | 261 | | T![if] |
262 | | T![in] | ||
261 | | T![loop] | 263 | | T![loop] |
262 | | T![match] | 264 | | T![match] |
263 | | T![return] | 265 | | T![return] |
264 | | T![while] | 266 | | T![while] |
265 | | T![in] => h | HlMod::ControlFlow, | 267 | | T![yield] => h | HlMod::ControlFlow, |
266 | T![for] if !is_child_of_impl(&element) => h | HlMod::ControlFlow, | 268 | T![for] if !is_child_of_impl(&element) => h | HlMod::ControlFlow, |
267 | T![unsafe] => h | HlMod::Unsafe, | 269 | T![unsafe] => h | HlMod::Unsafe, |
268 | T![true] | T![false] => HlTag::BoolLiteral.into(), | 270 | T![true] | T![false] => HlTag::BoolLiteral.into(), |
diff --git a/crates/ide/src/syntax_highlighting/tags.rs b/crates/ide/src/syntax_highlighting/tags.rs index e58392d67..336af3f4c 100644 --- a/crates/ide/src/syntax_highlighting/tags.rs +++ b/crates/ide/src/syntax_highlighting/tags.rs | |||
@@ -47,21 +47,27 @@ pub enum HlMod { | |||
47 | /// `foo` in `fn foo(x: i32)` is a definition, `foo` in `foo(90 + 2)` is | 47 | /// `foo` in `fn foo(x: i32)` is a definition, `foo` in `foo(90 + 2)` is |
48 | /// not. | 48 | /// not. |
49 | Definition, | 49 | Definition, |
50 | /// Doc-strings like this one. | ||
50 | Documentation, | 51 | Documentation, |
52 | /// Highlighting injection like rust code in doc strings or ra_fixture. | ||
51 | Injected, | 53 | Injected, |
54 | /// Mutable binding. | ||
52 | Mutable, | 55 | Mutable, |
56 | /// Value that is being consumed in a function call | ||
53 | Consuming, | 57 | Consuming, |
58 | /// Callable item or value. | ||
54 | Callable, | 59 | Callable, |
55 | /// Used for associated functions | 60 | /// Used for associated functions. |
56 | Static, | 61 | Static, |
57 | /// Used for items in impls&traits. | 62 | /// Used for items in traits and impls. |
58 | Associated, | 63 | Associated, |
59 | /// Used for intra doc links in doc injection. | 64 | /// Used for intra doc links in doc injection. |
60 | IntraDocLink, | 65 | IntraDocLink, |
61 | /// Used for items in traits and trait impls. | 66 | /// Used for items in traits and trait impls. |
62 | Trait, | 67 | Trait, |
63 | 68 | ||
64 | /// Keep this last! | 69 | // Keep this last! |
70 | /// Used for unsafe functions, mutable statics, union accesses and unsafe operations. | ||
65 | Unsafe, | 71 | Unsafe, |
66 | } | 72 | } |
67 | 73 | ||