aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src')
-rw-r--r--crates/ide/src/syntax_highlighting/highlight.rs7
-rw-r--r--crates/ide/src/syntax_highlighting/tags.rs4
2 files changed, 11 insertions, 0 deletions
diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs
index b586dcc17..bea506544 100644
--- a/crates/ide/src/syntax_highlighting/highlight.rs
+++ b/crates/ide/src/syntax_highlighting/highlight.rs
@@ -255,6 +255,7 @@ pub(super) fn element(
255 }) 255 })
256 .map(|modifier| h | modifier) 256 .map(|modifier| h | modifier)
257 .unwrap_or(h), 257 .unwrap_or(h),
258 T![async] | T![await] => h | HlMod::Async,
258 _ => h, 259 _ => h,
259 } 260 }
260 } 261 }
@@ -310,6 +311,9 @@ fn highlight_def(db: &RootDatabase, def: Definition) -> Highlight {
310 if func.is_unsafe(db) { 311 if func.is_unsafe(db) {
311 h |= HlMod::Unsafe; 312 h |= HlMod::Unsafe;
312 } 313 }
314 if func.is_async(db) {
315 h |= HlMod::Async;
316 }
313 return h; 317 return h;
314 } 318 }
315 hir::ModuleDef::Adt(hir::Adt::Struct(_)) => HlTag::Symbol(SymbolKind::Struct), 319 hir::ModuleDef::Adt(hir::Adt::Struct(_)) => HlTag::Symbol(SymbolKind::Struct),
@@ -409,6 +413,9 @@ fn highlight_method_call(
409 if func.is_unsafe(sema.db) || sema.is_unsafe_method_call(&method_call) { 413 if func.is_unsafe(sema.db) || sema.is_unsafe_method_call(&method_call) {
410 h |= HlMod::Unsafe; 414 h |= HlMod::Unsafe;
411 } 415 }
416 if func.is_async(sema.db) {
417 h |= HlMod::Async;
418 }
412 if func.as_assoc_item(sema.db).and_then(|it| it.containing_trait(sema.db)).is_some() { 419 if func.as_assoc_item(sema.db).and_then(|it| it.containing_trait(sema.db)).is_some() {
413 h |= HlMod::Trait 420 h |= HlMod::Trait
414 } 421 }
diff --git a/crates/ide/src/syntax_highlighting/tags.rs b/crates/ide/src/syntax_highlighting/tags.rs
index a304b3250..f4a2e7506 100644
--- a/crates/ide/src/syntax_highlighting/tags.rs
+++ b/crates/ide/src/syntax_highlighting/tags.rs
@@ -65,6 +65,8 @@ pub enum HlMod {
65 Static, 65 Static,
66 /// Used for items in traits and trait impls. 66 /// Used for items in traits and trait impls.
67 Trait, 67 Trait,
68 /// Used with keywords like `async` and `await`.
69 Async,
68 // Keep this last! 70 // Keep this last!
69 /// Used for unsafe functions, mutable statics, union accesses and unsafe operations. 71 /// Used for unsafe functions, mutable statics, union accesses and unsafe operations.
70 Unsafe, 72 Unsafe,
@@ -186,6 +188,7 @@ impl HlMod {
186 HlMod::Mutable, 188 HlMod::Mutable,
187 HlMod::Static, 189 HlMod::Static,
188 HlMod::Trait, 190 HlMod::Trait,
191 HlMod::Async,
189 HlMod::Unsafe, 192 HlMod::Unsafe,
190 ]; 193 ];
191 194
@@ -203,6 +206,7 @@ impl HlMod {
203 HlMod::Mutable => "mutable", 206 HlMod::Mutable => "mutable",
204 HlMod::Static => "static", 207 HlMod::Static => "static",
205 HlMod::Trait => "trait", 208 HlMod::Trait => "trait",
209 HlMod::Async => "async",
206 HlMod::Unsafe => "unsafe", 210 HlMod::Unsafe => "unsafe",
207 } 211 }
208 } 212 }