mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Highlight type names correctly
This commit is contained in:
parent
0545e4781d
commit
9146a64386
2 changed files with 20 additions and 3 deletions
|
|
@ -1,6 +1,8 @@
|
|||
use rustc_hash::{FxHashSet, FxHashMap};
|
||||
|
||||
use ra_syntax::{ast, AstNode, TextRange, Direction, SmolStr, SyntaxKind, SyntaxKind::*, SyntaxElement, T};
|
||||
use ra_syntax::{
|
||||
ast, AstNode, TextRange, Direction, SmolStr, SyntaxKind, SyntaxKind::*, SyntaxElement, T,
|
||||
};
|
||||
use ra_db::SourceDatabase;
|
||||
use ra_prof::profile;
|
||||
|
||||
|
|
@ -116,6 +118,19 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
|
|||
calc_binding_hash(file_id, &text, *shadow_count)
|
||||
});
|
||||
"variable"
|
||||
} else if name
|
||||
.syntax()
|
||||
.parent()
|
||||
.map(|x| {
|
||||
x.kind() == TYPE_PARAM
|
||||
|| x.kind() == STRUCT_DEF
|
||||
|| x.kind() == ENUM_DEF
|
||||
|| x.kind() == TRAIT_DEF
|
||||
|| x.kind() == TYPE_ALIAS_DEF
|
||||
})
|
||||
.unwrap_or(false)
|
||||
{
|
||||
"type"
|
||||
} else {
|
||||
"function"
|
||||
}
|
||||
|
|
@ -263,6 +278,7 @@ struct Foo {
|
|||
|
||||
fn foo<T>() -> T {
|
||||
unimplemented!();
|
||||
foo::<i32>();
|
||||
}
|
||||
|
||||
// comment
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue