aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/syntax_highlighting.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/syntax_highlighting.rs')
-rw-r--r--crates/ra_ide_api/src/syntax_highlighting.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs
index dcefb0513..739b898d2 100644
--- a/crates/ra_ide_api/src/syntax_highlighting.rs
+++ b/crates/ra_ide_api/src/syntax_highlighting.rs
@@ -1,6 +1,8 @@
1use rustc_hash::{FxHashSet, FxHashMap}; 1use rustc_hash::{FxHashSet, FxHashMap};
2 2
3use ra_syntax::{ast, AstNode, TextRange, Direction, SmolStr, SyntaxKind, SyntaxKind::*, SyntaxElement, T}; 3use ra_syntax::{
4 ast, AstNode, TextRange, Direction, SmolStr, SyntaxKind, SyntaxKind::*, SyntaxElement, T,
5};
4use ra_db::SourceDatabase; 6use ra_db::SourceDatabase;
5use ra_prof::profile; 7use ra_prof::profile;
6 8
@@ -116,6 +118,19 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
116 calc_binding_hash(file_id, &text, *shadow_count) 118 calc_binding_hash(file_id, &text, *shadow_count)
117 }); 119 });
118 "variable" 120 "variable"
121 } else if name
122 .syntax()
123 .parent()
124 .map(|x| {
125 x.kind() == TYPE_PARAM
126 || x.kind() == STRUCT_DEF
127 || x.kind() == ENUM_DEF
128 || x.kind() == TRAIT_DEF
129 || x.kind() == TYPE_ALIAS_DEF
130 })
131 .unwrap_or(false)
132 {
133 "type"
119 } else { 134 } else {
120 "function" 135 "function"
121 } 136 }
@@ -263,6 +278,7 @@ struct Foo {
263 278
264fn foo<T>() -> T { 279fn foo<T>() -> T {
265 unimplemented!(); 280 unimplemented!();
281 foo::<i32>();
266} 282}
267 283
268// comment 284// comment