mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
fix: Fix completions for locals not working properly inside macro calls
This commit is contained in:
parent
b74e96f509
commit
bdbffdd463
3 changed files with 45 additions and 19 deletions
|
@ -506,7 +506,11 @@ impl<'a> CompletionContext<'a> {
|
|||
|
||||
let original_token = original_file.syntax().token_at_offset(offset).left_biased()?;
|
||||
let token = sema.descend_into_macros_single(original_token.clone());
|
||||
let scope = sema.scope_at_offset(&token.parent()?, offset)?;
|
||||
|
||||
// adjust for macro input, this still fails if there is no token written yet
|
||||
let scope_offset = if original_token == token { offset } else { token.text_range().end() };
|
||||
let scope = sema.scope_at_offset(&token.parent()?, scope_offset)?;
|
||||
|
||||
let krate = scope.krate();
|
||||
let module = scope.module();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue