aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide_api/src/syntax_highlighting.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs
index ab69a4374..2158291dc 100644
--- a/crates/ra_ide_api/src/syntax_highlighting.rs
+++ b/crates/ra_ide_api/src/syntax_highlighting.rs
@@ -13,8 +13,15 @@ pub struct HighlightedRange {
13 13
14fn is_control_keyword(kind: SyntaxKind) -> bool { 14fn is_control_keyword(kind: SyntaxKind) -> bool {
15 match kind { 15 match kind {
16 FOR_KW | LOOP_KW | WHILE_KW | CONTINUE_KW | BREAK_KW | IF_KW | ELSE_KW | MATCH_KW 16 T![for]
17 | RETURN_KW => true, 17 | T![loop]
18 | T![while]
19 | T![continue]
20 | T![break]
21 | T![if]
22 | T![else]
23 | T![match]
24 | T![return] => true,
18 _ => false, 25 _ => false,
19 } 26 }
20} 27}
@@ -37,8 +44,8 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
37 NAME => "function", 44 NAME => "function",
38 INT_NUMBER | FLOAT_NUMBER | CHAR | BYTE => "literal", 45 INT_NUMBER | FLOAT_NUMBER | CHAR | BYTE => "literal",
39 LIFETIME => "parameter", 46 LIFETIME => "parameter",
40 UNSAFE_KW => "unsafe", 47 T![unsafe] => "keyword.unsafe",
41 k if is_control_keyword(k) => "control", 48 k if is_control_keyword(k) => "keyword.control",
42 k if k.is_keyword() => "keyword", 49 k if k.is_keyword() => "keyword",
43 _ => { 50 _ => {
44 if let Some(macro_call) = node.as_node().and_then(ast::MacroCall::cast) { 51 if let Some(macro_call) = node.as_node().and_then(ast::MacroCall::cast) {