diff options
Diffstat (limited to 'crates/ide')
-rw-r--r-- | crates/ide/src/doc_links.rs | 6 | ||||
-rw-r--r-- | crates/ide/src/goto_definition.rs | 6 | ||||
-rw-r--r-- | crates/ide/src/hover.rs | 6 | ||||
-rw-r--r-- | crates/ide/src/references.rs | 6 | ||||
-rw-r--r-- | crates/ide/src/references/rename.rs | 6 | ||||
-rw-r--r-- | crates/ide/src/syntax_highlighting.rs | 6 |
6 files changed, 18 insertions, 18 deletions
diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index 5e4147362..592a8e3ad 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs | |||
@@ -14,7 +14,7 @@ use hir::{ | |||
14 | ModuleDef, | 14 | ModuleDef, |
15 | }; | 15 | }; |
16 | use ide_db::{ | 16 | use ide_db::{ |
17 | defs::{classify_name, classify_name_ref, Definition}, | 17 | defs::{Definition, NameClass, NameRefClass}, |
18 | RootDatabase, | 18 | RootDatabase, |
19 | }; | 19 | }; |
20 | use syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset, T}; | 20 | use syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset, T}; |
@@ -232,8 +232,8 @@ pub(crate) fn external_docs( | |||
232 | let node = token.parent(); | 232 | let node = token.parent(); |
233 | let definition = match_ast! { | 233 | let definition = match_ast! { |
234 | match node { | 234 | match node { |
235 | ast::NameRef(name_ref) => classify_name_ref(&sema, &name_ref).map(|d| d.definition(sema.db)), | 235 | ast::NameRef(name_ref) => NameRefClass::classify(&sema, &name_ref).map(|d| d.definition(sema.db)), |
236 | ast::Name(name) => classify_name(&sema, &name).map(|d| d.reference_or_definition(sema.db)), | 236 | ast::Name(name) => NameClass::classify(&sema, &name).map(|d| d.reference_or_definition(sema.db)), |
237 | _ => None, | 237 | _ => None, |
238 | } | 238 | } |
239 | }; | 239 | }; |
diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index be2f81aab..db6ad689e 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use hir::Semantics; | 1 | use hir::Semantics; |
2 | use ide_db::{ | 2 | use ide_db::{ |
3 | defs::{classify_name, classify_name_ref}, | 3 | defs::{NameClass, NameRefClass}, |
4 | symbol_index, RootDatabase, | 4 | symbol_index, RootDatabase, |
5 | }; | 5 | }; |
6 | use syntax::{ | 6 | use syntax::{ |
@@ -40,7 +40,7 @@ pub(crate) fn goto_definition( | |||
40 | reference_definition(&sema, &name_ref).to_vec() | 40 | reference_definition(&sema, &name_ref).to_vec() |
41 | }, | 41 | }, |
42 | ast::Name(name) => { | 42 | ast::Name(name) => { |
43 | let def = classify_name(&sema, &name)?.reference_or_definition(sema.db); | 43 | let def = NameClass::classify(&sema, &name)?.reference_or_definition(sema.db); |
44 | let nav = def.try_to_nav(sema.db)?; | 44 | let nav = def.try_to_nav(sema.db)?; |
45 | vec![nav] | 45 | vec![nav] |
46 | }, | 46 | }, |
@@ -81,7 +81,7 @@ pub(crate) fn reference_definition( | |||
81 | sema: &Semantics<RootDatabase>, | 81 | sema: &Semantics<RootDatabase>, |
82 | name_ref: &ast::NameRef, | 82 | name_ref: &ast::NameRef, |
83 | ) -> ReferenceResult { | 83 | ) -> ReferenceResult { |
84 | let name_kind = classify_name_ref(sema, name_ref); | 84 | let name_kind = NameRefClass::classify(sema, name_ref); |
85 | if let Some(def) = name_kind { | 85 | if let Some(def) = name_kind { |
86 | let def = def.definition(sema.db); | 86 | let def = def.definition(sema.db); |
87 | return match def.try_to_nav(sema.db) { | 87 | return match def.try_to_nav(sema.db) { |
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 51f03c718..e915a753e 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs | |||
@@ -4,7 +4,7 @@ use hir::{ | |||
4 | Module, ModuleDef, ModuleSource, Semantics, | 4 | Module, ModuleDef, ModuleSource, Semantics, |
5 | }; | 5 | }; |
6 | use ide_db::{ | 6 | use ide_db::{ |
7 | defs::{classify_name, classify_name_ref, Definition}, | 7 | defs::{Definition, NameClass, NameRefClass}, |
8 | RootDatabase, | 8 | RootDatabase, |
9 | }; | 9 | }; |
10 | use itertools::Itertools; | 10 | use itertools::Itertools; |
@@ -107,8 +107,8 @@ pub(crate) fn hover( | |||
107 | let node = token.parent(); | 107 | let node = token.parent(); |
108 | let definition = match_ast! { | 108 | let definition = match_ast! { |
109 | match node { | 109 | match node { |
110 | ast::NameRef(name_ref) => classify_name_ref(&sema, &name_ref).map(|d| d.definition(sema.db)), | 110 | ast::Name(name) => NameClass::classify(&sema, &name).and_then(|d| d.definition(sema.db)), |
111 | ast::Name(name) => classify_name(&sema, &name).and_then(|d| d.definition(sema.db)), | 111 | ast::NameRef(name_ref) => NameRefClass::classify(&sema, &name_ref).map(|d| d.definition(sema.db)), |
112 | _ => None, | 112 | _ => None, |
113 | } | 113 | } |
114 | }; | 114 | }; |
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index 95d872b83..fc537b9c0 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs | |||
@@ -13,7 +13,7 @@ pub(crate) mod rename; | |||
13 | 13 | ||
14 | use hir::Semantics; | 14 | use hir::Semantics; |
15 | use ide_db::{ | 15 | use ide_db::{ |
16 | defs::{classify_name, classify_name_ref, Definition}, | 16 | defs::{Definition, NameClass, NameRefClass}, |
17 | search::SearchScope, | 17 | search::SearchScope, |
18 | RootDatabase, | 18 | RootDatabase, |
19 | }; | 19 | }; |
@@ -132,13 +132,13 @@ fn find_name( | |||
132 | opt_name: Option<ast::Name>, | 132 | opt_name: Option<ast::Name>, |
133 | ) -> Option<RangeInfo<Definition>> { | 133 | ) -> Option<RangeInfo<Definition>> { |
134 | if let Some(name) = opt_name { | 134 | if let Some(name) = opt_name { |
135 | let def = classify_name(sema, &name)?.reference_or_definition(sema.db); | 135 | let def = NameClass::classify(sema, &name)?.reference_or_definition(sema.db); |
136 | let range = name.syntax().text_range(); | 136 | let range = name.syntax().text_range(); |
137 | return Some(RangeInfo::new(range, def)); | 137 | return Some(RangeInfo::new(range, def)); |
138 | } | 138 | } |
139 | let name_ref = | 139 | let name_ref = |
140 | sema.find_node_at_offset_with_descend::<ast::NameRef>(&syntax, position.offset)?; | 140 | sema.find_node_at_offset_with_descend::<ast::NameRef>(&syntax, position.offset)?; |
141 | let def = classify_name_ref(sema, &name_ref)?.definition(sema.db); | 141 | let def = NameRefClass::classify(sema, &name_ref)?.definition(sema.db); |
142 | let range = name_ref.syntax().text_range(); | 142 | let range = name_ref.syntax().text_range(); |
143 | Some(RangeInfo::new(range, def)) | 143 | Some(RangeInfo::new(range, def)) |
144 | } | 144 | } |
diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs index f9a11e43d..35aafc49d 100644 --- a/crates/ide/src/references/rename.rs +++ b/crates/ide/src/references/rename.rs | |||
@@ -3,7 +3,7 @@ | |||
3 | use base_db::SourceDatabaseExt; | 3 | use base_db::SourceDatabaseExt; |
4 | use hir::{Module, ModuleDef, ModuleSource, Semantics}; | 4 | use hir::{Module, ModuleDef, ModuleSource, Semantics}; |
5 | use ide_db::{ | 5 | use ide_db::{ |
6 | defs::{classify_name, classify_name_ref, Definition, NameClass, NameRefClass}, | 6 | defs::{Definition, NameClass, NameRefClass}, |
7 | RootDatabase, | 7 | RootDatabase, |
8 | }; | 8 | }; |
9 | 9 | ||
@@ -88,13 +88,13 @@ fn find_module_at_offset( | |||
88 | let module = match_ast! { | 88 | let module = match_ast! { |
89 | match (ident.parent()) { | 89 | match (ident.parent()) { |
90 | ast::NameRef(name_ref) => { | 90 | ast::NameRef(name_ref) => { |
91 | match classify_name_ref(sema, &name_ref)? { | 91 | match NameRefClass::classify(sema, &name_ref)? { |
92 | NameRefClass::Definition(Definition::ModuleDef(ModuleDef::Module(module))) => module, | 92 | NameRefClass::Definition(Definition::ModuleDef(ModuleDef::Module(module))) => module, |
93 | _ => return None, | 93 | _ => return None, |
94 | } | 94 | } |
95 | }, | 95 | }, |
96 | ast::Name(name) => { | 96 | ast::Name(name) => { |
97 | match classify_name(&sema, &name)? { | 97 | match NameClass::classify(&sema, &name)? { |
98 | NameClass::Definition(Definition::ModuleDef(ModuleDef::Module(module))) => module, | 98 | NameClass::Definition(Definition::ModuleDef(ModuleDef::Module(module))) => module, |
99 | _ => return None, | 99 | _ => return None, |
100 | } | 100 | } |
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index 928f771a9..b35c03162 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs | |||
@@ -8,7 +8,7 @@ mod tests; | |||
8 | 8 | ||
9 | use hir::{Local, Name, Semantics, VariantDef}; | 9 | use hir::{Local, Name, Semantics, VariantDef}; |
10 | use ide_db::{ | 10 | use ide_db::{ |
11 | defs::{classify_name, classify_name_ref, Definition, NameClass, NameRefClass}, | 11 | defs::{Definition, NameClass, NameRefClass}, |
12 | RootDatabase, | 12 | RootDatabase, |
13 | }; | 13 | }; |
14 | use rustc_hash::FxHashMap; | 14 | use rustc_hash::FxHashMap; |
@@ -443,7 +443,7 @@ fn highlight_element( | |||
443 | // Highlight definitions depending on the "type" of the definition. | 443 | // Highlight definitions depending on the "type" of the definition. |
444 | NAME => { | 444 | NAME => { |
445 | let name = element.into_node().and_then(ast::Name::cast).unwrap(); | 445 | let name = element.into_node().and_then(ast::Name::cast).unwrap(); |
446 | let name_kind = classify_name(sema, &name); | 446 | let name_kind = NameClass::classify(sema, &name); |
447 | 447 | ||
448 | if let Some(NameClass::Definition(Definition::Local(local))) = &name_kind { | 448 | if let Some(NameClass::Definition(Definition::Local(local))) = &name_kind { |
449 | if let Some(name) = local.name(db) { | 449 | if let Some(name) = local.name(db) { |
@@ -480,7 +480,7 @@ fn highlight_element( | |||
480 | NAME_REF => { | 480 | NAME_REF => { |
481 | let name_ref = element.into_node().and_then(ast::NameRef::cast).unwrap(); | 481 | let name_ref = element.into_node().and_then(ast::NameRef::cast).unwrap(); |
482 | highlight_func_by_name_ref(sema, &name_ref).unwrap_or_else(|| { | 482 | highlight_func_by_name_ref(sema, &name_ref).unwrap_or_else(|| { |
483 | match classify_name_ref(sema, &name_ref) { | 483 | match NameRefClass::classify(sema, &name_ref) { |
484 | Some(name_kind) => match name_kind { | 484 | Some(name_kind) => match name_kind { |
485 | NameRefClass::ExternCrate(_) => HighlightTag::Module.into(), | 485 | NameRefClass::ExternCrate(_) => HighlightTag::Module.into(), |
486 | NameRefClass::Definition(def) => { | 486 | NameRefClass::Definition(def) => { |