diff options
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/display/navigation_target.rs | 16 | ||||
-rw-r--r-- | crates/ra_ide/src/hover.rs | 14 | ||||
-rw-r--r-- | crates/ra_ide/src/references.rs | 20 | ||||
-rw-r--r-- | crates/ra_ide/src/references/classify.rs | 36 | ||||
-rw-r--r-- | crates/ra_ide/src/references/search_scope.rs | 6 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting.rs | 24 |
6 files changed, 56 insertions, 60 deletions
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index 4d3dd477e..c9c14561a 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs | |||
@@ -13,7 +13,7 @@ use ra_syntax::{ | |||
13 | 13 | ||
14 | use crate::{ | 14 | use crate::{ |
15 | // expand::original_range, | 15 | // expand::original_range, |
16 | references::NameDefinition, | 16 | references::Definition, |
17 | FileSymbol, | 17 | FileSymbol, |
18 | }; | 18 | }; |
19 | 19 | ||
@@ -189,15 +189,15 @@ impl ToNav for FileSymbol { | |||
189 | } | 189 | } |
190 | } | 190 | } |
191 | 191 | ||
192 | impl TryToNav for NameDefinition { | 192 | impl TryToNav for Definition { |
193 | fn try_to_nav(&self, db: &RootDatabase) -> Option<NavigationTarget> { | 193 | fn try_to_nav(&self, db: &RootDatabase) -> Option<NavigationTarget> { |
194 | match self { | 194 | match self { |
195 | NameDefinition::Macro(it) => Some(it.to_nav(db)), | 195 | Definition::Macro(it) => Some(it.to_nav(db)), |
196 | NameDefinition::StructField(it) => Some(it.to_nav(db)), | 196 | Definition::StructField(it) => Some(it.to_nav(db)), |
197 | NameDefinition::ModuleDef(it) => it.try_to_nav(db), | 197 | Definition::ModuleDef(it) => it.try_to_nav(db), |
198 | NameDefinition::SelfType(it) => Some(it.to_nav(db)), | 198 | Definition::SelfType(it) => Some(it.to_nav(db)), |
199 | NameDefinition::Local(it) => Some(it.to_nav(db)), | 199 | Definition::Local(it) => Some(it.to_nav(db)), |
200 | NameDefinition::TypeParam(it) => Some(it.to_nav(db)), | 200 | Definition::TypeParam(it) => Some(it.to_nav(db)), |
201 | } | 201 | } |
202 | } | 202 | } |
203 | } | 203 | } |
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index b31956626..26c8996bc 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use hir::{Adt, HasSource, HirDisplay, Semantics}; | 3 | use hir::{Adt, HasSource, HirDisplay, Semantics}; |
4 | use ra_ide_db::{ | 4 | use ra_ide_db::{ |
5 | defs::{classify_name, NameDefinition}, | 5 | defs::{classify_name, Definition}, |
6 | RootDatabase, | 6 | RootDatabase, |
7 | }; | 7 | }; |
8 | use ra_syntax::{ | 8 | use ra_syntax::{ |
@@ -92,20 +92,20 @@ fn hover_text(docs: Option<String>, desc: Option<String>) -> Option<String> { | |||
92 | } | 92 | } |
93 | } | 93 | } |
94 | 94 | ||
95 | fn hover_text_from_name_kind(db: &RootDatabase, def: NameDefinition) -> Option<String> { | 95 | fn hover_text_from_name_kind(db: &RootDatabase, def: Definition) -> Option<String> { |
96 | return match def { | 96 | return match def { |
97 | NameDefinition::Macro(it) => { | 97 | Definition::Macro(it) => { |
98 | let src = it.source(db); | 98 | let src = it.source(db); |
99 | hover_text(src.value.doc_comment_text(), Some(macro_label(&src.value))) | 99 | hover_text(src.value.doc_comment_text(), Some(macro_label(&src.value))) |
100 | } | 100 | } |
101 | NameDefinition::StructField(it) => { | 101 | Definition::StructField(it) => { |
102 | let src = it.source(db); | 102 | let src = it.source(db); |
103 | match src.value { | 103 | match src.value { |
104 | hir::FieldSource::Named(it) => hover_text(it.doc_comment_text(), it.short_label()), | 104 | hir::FieldSource::Named(it) => hover_text(it.doc_comment_text(), it.short_label()), |
105 | _ => None, | 105 | _ => None, |
106 | } | 106 | } |
107 | } | 107 | } |
108 | NameDefinition::ModuleDef(it) => match it { | 108 | Definition::ModuleDef(it) => match it { |
109 | hir::ModuleDef::Module(it) => match it.definition_source(db).value { | 109 | hir::ModuleDef::Module(it) => match it.definition_source(db).value { |
110 | hir::ModuleSource::Module(it) => { | 110 | hir::ModuleSource::Module(it) => { |
111 | hover_text(it.doc_comment_text(), it.short_label()) | 111 | hover_text(it.doc_comment_text(), it.short_label()) |
@@ -123,10 +123,10 @@ fn hover_text_from_name_kind(db: &RootDatabase, def: NameDefinition) -> Option<S | |||
123 | hir::ModuleDef::TypeAlias(it) => from_def_source(db, it), | 123 | hir::ModuleDef::TypeAlias(it) => from_def_source(db, it), |
124 | hir::ModuleDef::BuiltinType(it) => Some(it.to_string()), | 124 | hir::ModuleDef::BuiltinType(it) => Some(it.to_string()), |
125 | }, | 125 | }, |
126 | NameDefinition::Local(it) => { | 126 | Definition::Local(it) => { |
127 | Some(rust_code_markup(it.ty(db).display_truncated(db, None).to_string())) | 127 | Some(rust_code_markup(it.ty(db).display_truncated(db, None).to_string())) |
128 | } | 128 | } |
129 | NameDefinition::TypeParam(_) | NameDefinition::SelfType(_) => { | 129 | Definition::TypeParam(_) | Definition::SelfType(_) => { |
130 | // FIXME: Hover for generic param | 130 | // FIXME: Hover for generic param |
131 | None | 131 | None |
132 | } | 132 | } |
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index c9c9c6483..95a5c1914 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs | |||
@@ -31,7 +31,7 @@ pub(crate) use self::{ | |||
31 | classify::{classify_name_ref, NameRefClass}, | 31 | classify::{classify_name_ref, NameRefClass}, |
32 | rename::rename, | 32 | rename::rename, |
33 | }; | 33 | }; |
34 | pub(crate) use ra_ide_db::defs::{classify_name, NameDefinition}; | 34 | pub(crate) use ra_ide_db::defs::{classify_name, Definition}; |
35 | 35 | ||
36 | pub use self::search_scope::SearchScope; | 36 | pub use self::search_scope::SearchScope; |
37 | 37 | ||
@@ -145,7 +145,7 @@ pub(crate) fn find_all_refs( | |||
145 | 145 | ||
146 | pub(crate) fn find_refs_to_def( | 146 | pub(crate) fn find_refs_to_def( |
147 | db: &RootDatabase, | 147 | db: &RootDatabase, |
148 | def: &NameDefinition, | 148 | def: &Definition, |
149 | search_scope: Option<SearchScope>, | 149 | search_scope: Option<SearchScope>, |
150 | ) -> Vec<Reference> { | 150 | ) -> Vec<Reference> { |
151 | let search_scope = { | 151 | let search_scope = { |
@@ -169,7 +169,7 @@ fn find_name( | |||
169 | syntax: &SyntaxNode, | 169 | syntax: &SyntaxNode, |
170 | position: FilePosition, | 170 | position: FilePosition, |
171 | opt_name: Option<ast::Name>, | 171 | opt_name: Option<ast::Name>, |
172 | ) -> Option<RangeInfo<NameDefinition>> { | 172 | ) -> Option<RangeInfo<Definition>> { |
173 | if let Some(name) = opt_name { | 173 | if let Some(name) = opt_name { |
174 | let def = classify_name(sema, &name)?.definition(); | 174 | let def = classify_name(sema, &name)?.definition(); |
175 | let range = name.syntax().text_range(); | 175 | let range = name.syntax().text_range(); |
@@ -183,7 +183,7 @@ fn find_name( | |||
183 | 183 | ||
184 | fn process_definition( | 184 | fn process_definition( |
185 | db: &RootDatabase, | 185 | db: &RootDatabase, |
186 | def: &NameDefinition, | 186 | def: &Definition, |
187 | name: String, | 187 | name: String, |
188 | scope: SearchScope, | 188 | scope: SearchScope, |
189 | ) -> Vec<Reference> { | 189 | ) -> Vec<Reference> { |
@@ -250,13 +250,9 @@ fn process_definition( | |||
250 | refs | 250 | refs |
251 | } | 251 | } |
252 | 252 | ||
253 | fn decl_access( | 253 | fn decl_access(def: &Definition, syntax: &SyntaxNode, range: TextRange) -> Option<ReferenceAccess> { |
254 | def: &NameDefinition, | ||
255 | syntax: &SyntaxNode, | ||
256 | range: TextRange, | ||
257 | ) -> Option<ReferenceAccess> { | ||
258 | match def { | 254 | match def { |
259 | NameDefinition::Local(_) | NameDefinition::StructField(_) => {} | 255 | Definition::Local(_) | Definition::StructField(_) => {} |
260 | _ => return None, | 256 | _ => return None, |
261 | }; | 257 | }; |
262 | 258 | ||
@@ -273,10 +269,10 @@ fn decl_access( | |||
273 | None | 269 | None |
274 | } | 270 | } |
275 | 271 | ||
276 | fn reference_access(def: &NameDefinition, name_ref: &ast::NameRef) -> Option<ReferenceAccess> { | 272 | fn reference_access(def: &Definition, name_ref: &ast::NameRef) -> Option<ReferenceAccess> { |
277 | // Only Locals and Fields have accesses for now. | 273 | // Only Locals and Fields have accesses for now. |
278 | match def { | 274 | match def { |
279 | NameDefinition::Local(_) | NameDefinition::StructField(_) => {} | 275 | Definition::Local(_) | Definition::StructField(_) => {} |
280 | _ => return None, | 276 | _ => return None, |
281 | }; | 277 | }; |
282 | 278 | ||
diff --git a/crates/ra_ide/src/references/classify.rs b/crates/ra_ide/src/references/classify.rs index 571236fdc..0bbf893f8 100644 --- a/crates/ra_ide/src/references/classify.rs +++ b/crates/ra_ide/src/references/classify.rs | |||
@@ -1,22 +1,22 @@ | |||
1 | //! Functions that are used to classify an element from its definition or reference. | 1 | //! Functions that are used to classify an element from its definition or reference. |
2 | 2 | ||
3 | use hir::{Local, PathResolution, Semantics}; | 3 | use hir::{Local, PathResolution, Semantics}; |
4 | use ra_ide_db::defs::NameDefinition; | 4 | use ra_ide_db::defs::Definition; |
5 | use ra_ide_db::RootDatabase; | 5 | use ra_ide_db::RootDatabase; |
6 | use ra_prof::profile; | 6 | use ra_prof::profile; |
7 | use ra_syntax::{ast, AstNode}; | 7 | use ra_syntax::{ast, AstNode}; |
8 | use test_utils::tested_by; | 8 | use test_utils::tested_by; |
9 | 9 | ||
10 | pub enum NameRefClass { | 10 | pub enum NameRefClass { |
11 | NameDefinition(NameDefinition), | 11 | Definition(Definition), |
12 | FieldShorthand { local: Local, field: NameDefinition }, | 12 | FieldShorthand { local: Local, field: Definition }, |
13 | } | 13 | } |
14 | 14 | ||
15 | impl NameRefClass { | 15 | impl NameRefClass { |
16 | pub fn definition(self) -> NameDefinition { | 16 | pub fn definition(self) -> Definition { |
17 | match self { | 17 | match self { |
18 | NameRefClass::NameDefinition(def) => def, | 18 | NameRefClass::Definition(def) => def, |
19 | NameRefClass::FieldShorthand { local, field: _ } => NameDefinition::Local(local), | 19 | NameRefClass::FieldShorthand { local, field: _ } => Definition::Local(local), |
20 | } | 20 | } |
21 | } | 21 | } |
22 | } | 22 | } |
@@ -32,14 +32,14 @@ pub(crate) fn classify_name_ref( | |||
32 | if let Some(method_call) = ast::MethodCallExpr::cast(parent.clone()) { | 32 | if let Some(method_call) = ast::MethodCallExpr::cast(parent.clone()) { |
33 | tested_by!(goto_def_for_methods); | 33 | tested_by!(goto_def_for_methods); |
34 | if let Some(func) = sema.resolve_method_call(&method_call) { | 34 | if let Some(func) = sema.resolve_method_call(&method_call) { |
35 | return Some(NameRefClass::NameDefinition(NameDefinition::ModuleDef(func.into()))); | 35 | return Some(NameRefClass::Definition(Definition::ModuleDef(func.into()))); |
36 | } | 36 | } |
37 | } | 37 | } |
38 | 38 | ||
39 | if let Some(field_expr) = ast::FieldExpr::cast(parent.clone()) { | 39 | if let Some(field_expr) = ast::FieldExpr::cast(parent.clone()) { |
40 | tested_by!(goto_def_for_fields); | 40 | tested_by!(goto_def_for_fields); |
41 | if let Some(field) = sema.resolve_field(&field_expr) { | 41 | if let Some(field) = sema.resolve_field(&field_expr) { |
42 | return Some(NameRefClass::NameDefinition(NameDefinition::StructField(field))); | 42 | return Some(NameRefClass::Definition(Definition::StructField(field))); |
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 | ||
@@ -47,9 +47,9 @@ pub(crate) fn classify_name_ref( | |||
47 | tested_by!(goto_def_for_record_fields); | 47 | tested_by!(goto_def_for_record_fields); |
48 | tested_by!(goto_def_for_field_init_shorthand); | 48 | tested_by!(goto_def_for_field_init_shorthand); |
49 | if let Some((field, local)) = sema.resolve_record_field(&record_field) { | 49 | if let Some((field, local)) = sema.resolve_record_field(&record_field) { |
50 | let field = NameDefinition::StructField(field); | 50 | let field = Definition::StructField(field); |
51 | let res = match local { | 51 | let res = match local { |
52 | None => NameRefClass::NameDefinition(field), | 52 | None => NameRefClass::Definition(field), |
53 | Some(local) => NameRefClass::FieldShorthand { field, local }, | 53 | Some(local) => NameRefClass::FieldShorthand { field, local }, |
54 | }; | 54 | }; |
55 | return Some(res); | 55 | return Some(res); |
@@ -59,26 +59,26 @@ pub(crate) fn classify_name_ref( | |||
59 | if let Some(macro_call) = parent.ancestors().find_map(ast::MacroCall::cast) { | 59 | if let Some(macro_call) = parent.ancestors().find_map(ast::MacroCall::cast) { |
60 | tested_by!(goto_def_for_macros); | 60 | tested_by!(goto_def_for_macros); |
61 | if let Some(macro_def) = sema.resolve_macro_call(¯o_call) { | 61 | if let Some(macro_def) = sema.resolve_macro_call(¯o_call) { |
62 | return Some(NameRefClass::NameDefinition(NameDefinition::Macro(macro_def))); | 62 | return Some(NameRefClass::Definition(Definition::Macro(macro_def))); |
63 | } | 63 | } |
64 | } | 64 | } |
65 | 65 | ||
66 | let path = name_ref.syntax().ancestors().find_map(ast::Path::cast)?; | 66 | let path = name_ref.syntax().ancestors().find_map(ast::Path::cast)?; |
67 | let resolved = sema.resolve_path(&path)?; | 67 | let resolved = sema.resolve_path(&path)?; |
68 | let res = match resolved { | 68 | let res = match resolved { |
69 | PathResolution::Def(def) => NameDefinition::ModuleDef(def), | 69 | PathResolution::Def(def) => Definition::ModuleDef(def), |
70 | PathResolution::AssocItem(item) => { | 70 | PathResolution::AssocItem(item) => { |
71 | let def = match item { | 71 | let def = match item { |
72 | hir::AssocItem::Function(it) => it.into(), | 72 | hir::AssocItem::Function(it) => it.into(), |
73 | hir::AssocItem::Const(it) => it.into(), | 73 | hir::AssocItem::Const(it) => it.into(), |
74 | hir::AssocItem::TypeAlias(it) => it.into(), | 74 | hir::AssocItem::TypeAlias(it) => it.into(), |
75 | }; | 75 | }; |
76 | NameDefinition::ModuleDef(def) | 76 | Definition::ModuleDef(def) |
77 | } | 77 | } |
78 | PathResolution::Local(local) => NameDefinition::Local(local), | 78 | PathResolution::Local(local) => Definition::Local(local), |
79 | PathResolution::TypeParam(par) => NameDefinition::TypeParam(par), | 79 | PathResolution::TypeParam(par) => Definition::TypeParam(par), |
80 | PathResolution::Macro(def) => NameDefinition::Macro(def), | 80 | PathResolution::Macro(def) => Definition::Macro(def), |
81 | PathResolution::SelfType(impl_def) => NameDefinition::SelfType(impl_def), | 81 | PathResolution::SelfType(impl_def) => Definition::SelfType(impl_def), |
82 | }; | 82 | }; |
83 | Some(NameRefClass::NameDefinition(res)) | 83 | Some(NameRefClass::Definition(res)) |
84 | } | 84 | } |
diff --git a/crates/ra_ide/src/references/search_scope.rs b/crates/ra_ide/src/references/search_scope.rs index 27d483233..d98c84d91 100644 --- a/crates/ra_ide/src/references/search_scope.rs +++ b/crates/ra_ide/src/references/search_scope.rs | |||
@@ -12,7 +12,7 @@ use rustc_hash::FxHashMap; | |||
12 | 12 | ||
13 | use ra_ide_db::RootDatabase; | 13 | use ra_ide_db::RootDatabase; |
14 | 14 | ||
15 | use super::NameDefinition; | 15 | use super::Definition; |
16 | 16 | ||
17 | pub struct SearchScope { | 17 | pub struct SearchScope { |
18 | entries: FxHashMap<FileId, Option<TextRange>>, | 18 | entries: FxHashMap<FileId, Option<TextRange>>, |
@@ -23,7 +23,7 @@ impl SearchScope { | |||
23 | SearchScope { entries: FxHashMap::default() } | 23 | SearchScope { entries: FxHashMap::default() } |
24 | } | 24 | } |
25 | 25 | ||
26 | pub(crate) fn for_def(def: &NameDefinition, db: &RootDatabase) -> SearchScope { | 26 | pub(crate) fn for_def(def: &Definition, db: &RootDatabase) -> SearchScope { |
27 | let _p = profile("search_scope"); | 27 | let _p = profile("search_scope"); |
28 | let module = match def.module(db) { | 28 | let module = match def.module(db) { |
29 | Some(it) => it, | 29 | Some(it) => it, |
@@ -32,7 +32,7 @@ impl SearchScope { | |||
32 | let module_src = module.definition_source(db); | 32 | let module_src = module.definition_source(db); |
33 | let file_id = module_src.file_id.original_file(db); | 33 | let file_id = module_src.file_id.original_file(db); |
34 | 34 | ||
35 | if let NameDefinition::Local(var) = def { | 35 | if let Definition::Local(var) = def { |
36 | let range = match var.parent(db) { | 36 | let range = match var.parent(db) { |
37 | DefWithBody::Function(f) => f.source(db).value.syntax().text_range(), | 37 | DefWithBody::Function(f) => f.source(db).value.syntax().text_range(), |
38 | DefWithBody::Const(c) => c.source(db).value.syntax().text_range(), | 38 | DefWithBody::Const(c) => c.source(db).value.syntax().text_range(), |
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 7e41db530..9e0ee2158 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -7,7 +7,7 @@ mod tests; | |||
7 | 7 | ||
8 | use hir::{Name, Semantics}; | 8 | use hir::{Name, Semantics}; |
9 | use ra_ide_db::{ | 9 | use ra_ide_db::{ |
10 | defs::{classify_name, NameClass, NameDefinition}, | 10 | defs::{classify_name, Definition, NameClass}, |
11 | RootDatabase, | 11 | RootDatabase, |
12 | }; | 12 | }; |
13 | use ra_prof::profile; | 13 | use ra_prof::profile; |
@@ -172,7 +172,7 @@ fn highlight_element( | |||
172 | let name = element.into_node().and_then(ast::Name::cast).unwrap(); | 172 | let name = element.into_node().and_then(ast::Name::cast).unwrap(); |
173 | let name_kind = classify_name(sema, &name); | 173 | let name_kind = classify_name(sema, &name); |
174 | 174 | ||
175 | if let Some(NameClass::NameDefinition(NameDefinition::Local(local))) = &name_kind { | 175 | if let Some(NameClass::Definition(Definition::Local(local))) = &name_kind { |
176 | if let Some(name) = local.name(db) { | 176 | if let Some(name) = local.name(db) { |
177 | let shadow_count = bindings_shadow_count.entry(name.clone()).or_default(); | 177 | let shadow_count = bindings_shadow_count.entry(name.clone()).or_default(); |
178 | *shadow_count += 1; | 178 | *shadow_count += 1; |
@@ -181,7 +181,7 @@ fn highlight_element( | |||
181 | }; | 181 | }; |
182 | 182 | ||
183 | match name_kind { | 183 | match name_kind { |
184 | Some(NameClass::NameDefinition(def)) => { | 184 | Some(NameClass::Definition(def)) => { |
185 | highlight_name(db, def) | HighlightModifier::Definition | 185 | highlight_name(db, def) | HighlightModifier::Definition |
186 | } | 186 | } |
187 | Some(NameClass::ConstReference(def)) => highlight_name(db, def), | 187 | Some(NameClass::ConstReference(def)) => highlight_name(db, def), |
@@ -196,8 +196,8 @@ fn highlight_element( | |||
196 | let name_kind = classify_name_ref(sema, &name_ref)?; | 196 | let name_kind = classify_name_ref(sema, &name_ref)?; |
197 | 197 | ||
198 | match name_kind { | 198 | match name_kind { |
199 | NameRefClass::NameDefinition(def) => { | 199 | NameRefClass::Definition(def) => { |
200 | if let NameDefinition::Local(local) = &def { | 200 | if let Definition::Local(local) = &def { |
201 | if let Some(name) = local.name(db) { | 201 | if let Some(name) = local.name(db) { |
202 | let shadow_count = | 202 | let shadow_count = |
203 | bindings_shadow_count.entry(name.clone()).or_default(); | 203 | bindings_shadow_count.entry(name.clone()).or_default(); |
@@ -260,11 +260,11 @@ fn highlight_element( | |||
260 | } | 260 | } |
261 | } | 261 | } |
262 | 262 | ||
263 | fn highlight_name(db: &RootDatabase, def: NameDefinition) -> Highlight { | 263 | fn highlight_name(db: &RootDatabase, def: Definition) -> Highlight { |
264 | match def { | 264 | match def { |
265 | NameDefinition::Macro(_) => HighlightTag::Macro, | 265 | Definition::Macro(_) => HighlightTag::Macro, |
266 | NameDefinition::StructField(_) => HighlightTag::Field, | 266 | Definition::StructField(_) => HighlightTag::Field, |
267 | NameDefinition::ModuleDef(def) => match def { | 267 | Definition::ModuleDef(def) => match def { |
268 | hir::ModuleDef::Module(_) => HighlightTag::Module, | 268 | hir::ModuleDef::Module(_) => HighlightTag::Module, |
269 | hir::ModuleDef::Function(_) => HighlightTag::Function, | 269 | hir::ModuleDef::Function(_) => HighlightTag::Function, |
270 | hir::ModuleDef::Adt(hir::Adt::Struct(_)) => HighlightTag::Struct, | 270 | hir::ModuleDef::Adt(hir::Adt::Struct(_)) => HighlightTag::Struct, |
@@ -277,10 +277,10 @@ fn highlight_name(db: &RootDatabase, def: NameDefinition) -> Highlight { | |||
277 | hir::ModuleDef::TypeAlias(_) => HighlightTag::TypeAlias, | 277 | hir::ModuleDef::TypeAlias(_) => HighlightTag::TypeAlias, |
278 | hir::ModuleDef::BuiltinType(_) => HighlightTag::BuiltinType, | 278 | hir::ModuleDef::BuiltinType(_) => HighlightTag::BuiltinType, |
279 | }, | 279 | }, |
280 | NameDefinition::SelfType(_) => HighlightTag::SelfType, | 280 | Definition::SelfType(_) => HighlightTag::SelfType, |
281 | NameDefinition::TypeParam(_) => HighlightTag::TypeParam, | 281 | Definition::TypeParam(_) => HighlightTag::TypeParam, |
282 | // FIXME: distinguish between locals and parameters | 282 | // FIXME: distinguish between locals and parameters |
283 | NameDefinition::Local(local) => { | 283 | Definition::Local(local) => { |
284 | let mut h = Highlight::new(HighlightTag::Local); | 284 | let mut h = Highlight::new(HighlightTag::Local); |
285 | if local.is_mut(db) || local.ty(db).is_mutable_reference() { | 285 | if local.is_mut(db) || local.ty(db).is_mutable_reference() { |
286 | h |= HighlightModifier::Mutable; | 286 | h |= HighlightModifier::Mutable; |