Skip to content

Commit 91046e9

Browse files
committed
fix: Fix completions analysis not caching all nodes in Semantics
1 parent 3ce3593 commit 91046e9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

crates/ide-completion/src/context/analysis.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Module responsible for analyzing the code surrounding the cursor for completion.
22
use std::iter;
33

4-
use hir::{HasSource, Semantics, Type, TypeInfo, Variant};
4+
use hir::{Semantics, Type, TypeInfo, Variant};
55
use ide_db::{active_parameter::ActiveParameter, RootDatabase};
66
use syntax::{
77
algo::{find_node_at_offset, non_trivia_sibling},
@@ -740,13 +740,13 @@ fn classify_name_ref(
740740
match sema.resolve_path(&segment.parent_path().top_path())? {
741741
hir::PathResolution::Def(def) => match def {
742742
hir::ModuleDef::Function(func) => {
743-
func.source(sema.db)?.value.generic_param_list()
743+
sema.source(func)?.value.generic_param_list()
744744
}
745745
hir::ModuleDef::Adt(adt) => {
746-
adt.source(sema.db)?.value.generic_param_list()
746+
sema.source(adt)?.value.generic_param_list()
747747
}
748748
hir::ModuleDef::Variant(variant) => {
749-
variant.parent_enum(sema.db).source(sema.db)?.value.generic_param_list()
749+
sema.source(variant.parent_enum(sema.db))?.value.generic_param_list()
750750
}
751751
hir::ModuleDef::Trait(trait_) => {
752752
if let ast::GenericArg::AssocTypeArg(arg) = &arg {
@@ -772,14 +772,14 @@ fn classify_name_ref(
772772
return None;
773773
} else {
774774
in_trait = Some(trait_);
775-
trait_.source(sema.db)?.value.generic_param_list()
775+
sema.source(trait_)?.value.generic_param_list()
776776
}
777777
}
778778
hir::ModuleDef::TraitAlias(trait_) => {
779-
trait_.source(sema.db)?.value.generic_param_list()
779+
sema.source(trait_)?.value.generic_param_list()
780780
}
781781
hir::ModuleDef::TypeAlias(ty_) => {
782-
ty_.source(sema.db)?.value.generic_param_list()
782+
sema.source(ty_)?.value.generic_param_list()
783783
}
784784
_ => None,
785785
},
@@ -788,7 +788,7 @@ fn classify_name_ref(
788788
},
789789
ast::MethodCallExpr(call) => {
790790
let func = sema.resolve_method_call(&call)?;
791-
func.source(sema.db)?.value.generic_param_list()
791+
sema.source(func)?.value.generic_param_list()
792792
},
793793
ast::AssocTypeArg(arg) => {
794794
let trait_ = ast::PathSegment::cast(arg.syntax().parent()?.parent()?)?;
@@ -805,7 +805,7 @@ fn classify_name_ref(
805805
},
806806
_ => None,
807807
})?;
808-
assoc_ty.source(sema.db)?.value.generic_param_list()
808+
sema.source(*assoc_ty)?.value.generic_param_list()
809809
}
810810
_ => None,
811811
},

0 commit comments

Comments
 (0)