Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/static_index.rs')
-rw-r--r--crates/ide/src/static_index.rs22
1 files changed, 8 insertions, 14 deletions
diff --git a/crates/ide/src/static_index.rs b/crates/ide/src/static_index.rs
index 30e8d62ea2..7749f8e2f2 100644
--- a/crates/ide/src/static_index.rs
+++ b/crates/ide/src/static_index.rs
@@ -10,7 +10,7 @@ use ide_db::{
documentation::Documentation,
famous_defs::FamousDefs,
};
-use syntax::{AstNode, SyntaxKind::*, SyntaxNode, SyntaxToken, T, TextRange};
+use syntax::{AstNode, SyntaxNode, SyntaxToken, TextRange};
use crate::navigation_target::UpmappingResult;
use crate::{
@@ -136,12 +136,12 @@ fn documentation_for_definition(
}
// FIXME: This is a weird function
-fn get_definitions(
- sema: &Semantics<'_, RootDatabase>,
+fn get_definitions<'db>(
+ sema: &Semantics<'db, RootDatabase>,
token: SyntaxToken,
-) -> Option<ArrayVec<Definition, 2>> {
+) -> Option<ArrayVec<(Definition, Option<hir::GenericSubstitution<'db>>), 2>> {
for token in sema.descend_into_macros_exact(token) {
- let def = IdentClass::classify_token(sema, &token).map(IdentClass::definitions_no_ops);
+ let def = IdentClass::classify_token(sema, &token).map(IdentClass::definitions);
if let Some(defs) = def
&& !defs.is_empty()
{
@@ -226,12 +226,6 @@ impl StaticIndex<'_> {
show_drop_glue: true,
minicore: MiniCore::default(),
};
- let tokens = tokens.filter(|token| {
- matches!(
- token.kind(),
- IDENT | INT_NUMBER | LIFETIME_IDENT | T![self] | T![super] | T![crate] | T![Self]
- )
- });
let mut result = StaticIndexedFile { file_id, inlay_hints, folds, tokens: vec![] };
let mut add_token = |def: Definition, range: TextRange, scope_node: &SyntaxNode| {
@@ -291,9 +285,9 @@ impl StaticIndex<'_> {
let range = token.text_range();
let node = token.parent().unwrap();
match hir::attach_db(self.db, || get_definitions(&sema, token.clone())) {
- Some(it) => {
- for i in it {
- add_token(i, range, &node);
+ Some(defs) => {
+ for (def, _) in defs {
+ add_token(def, range, &node);
}
}
None => continue,