Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/context.rs')
-rw-r--r--crates/ide-completion/src/context.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/ide-completion/src/context.rs b/crates/ide-completion/src/context.rs
index 2f1860cbb5..7862b25878 100644
--- a/crates/ide-completion/src/context.rs
+++ b/crates/ide-completion/src/context.rs
@@ -442,6 +442,8 @@ pub(crate) struct CompletionContext<'a> {
pub(crate) krate: hir::Crate,
/// The module of the `scope`.
pub(crate) module: hir::Module,
+ /// The function where we're completing, if inside a function.
+ pub(crate) containing_function: Option<hir::Function>,
/// Whether nightly toolchain is used. Cached since this is looked up a lot.
pub(crate) is_nightly: bool,
/// The edition of the current crate
@@ -760,6 +762,7 @@ impl<'a> CompletionContext<'a> {
let krate = scope.krate();
let module = scope.module();
+ let containing_function = scope.containing_function();
let edition = krate.edition(db);
let toolchain = db.toolchain_channel(krate.into());
@@ -874,6 +877,7 @@ impl<'a> CompletionContext<'a> {
token,
krate,
module,
+ containing_function,
is_nightly,
edition,
expected_name,