Skip to content

Commit c005ce6

Browse files
committed
Tag yield and await as ControlFlow in semantic highlighting
1 parent 85bab75 commit c005ce6

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

crates/ide/src/syntax_highlighting/highlight.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,15 +254,17 @@ pub(super) fn element(
254254
k if k.is_keyword() => {
255255
let h = Highlight::new(HlTag::Keyword);
256256
match k {
257-
T![break]
257+
T![await]
258+
| T![break]
258259
| T![continue]
259260
| T![else]
260261
| T![if]
262+
| T![in]
261263
| T![loop]
262264
| T![match]
263265
| T![return]
264266
| T![while]
265-
| T![in] => h | HlMod::ControlFlow,
267+
| T![yield] => h | HlMod::ControlFlow,
266268
T![for] if !is_child_of_impl(&element) => h | HlMod::ControlFlow,
267269
T![unsafe] => h | HlMod::Unsafe,
268270
T![true] | T![false] => HlTag::BoolLiteral.into(),

crates/ide/src/syntax_highlighting/tags.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,27 @@ pub enum HlMod {
4747
/// `foo` in `fn foo(x: i32)` is a definition, `foo` in `foo(90 + 2)` is
4848
/// not.
4949
Definition,
50+
/// Doc-strings like this one.
5051
Documentation,
52+
/// Highlighting injection like rust code in doc strings or ra_fixture.
5153
Injected,
54+
/// Mutable binding.
5255
Mutable,
56+
/// Value that is being consumed in a function call
5357
Consuming,
58+
/// Callable item or value.
5459
Callable,
55-
/// Used for associated functions
60+
/// Used for associated functions.
5661
Static,
57-
/// Used for items in impls&traits.
62+
/// Used for items in traits and impls.
5863
Associated,
5964
/// Used for intra doc links in doc injection.
6065
IntraDocLink,
6166
/// Used for items in traits and trait impls.
6267
Trait,
6368

64-
/// Keep this last!
69+
// Keep this last!
70+
/// Used for unsafe functions, mutable statics, union accesses and unsafe operations.
6571
Unsafe,
6672
}
6773

0 commit comments

Comments
 (0)