mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Fix a case where completion was unable to expand a macro
Which caused the macros of the popular `tracing` crate to not offer completions. The reason is rather complicated: it boils down to macro ignoring their input and completion always choosing the first expansion.
This commit is contained in:
parent
e0c11f631e
commit
02d47f3a81
16 changed files with 604 additions and 368 deletions
|
@ -718,7 +718,7 @@ impl<'a> CompletionContext<'a> {
|
|||
expected: (expected_type, expected_name),
|
||||
qualifier_ctx,
|
||||
token,
|
||||
offset,
|
||||
original_offset,
|
||||
} = expand_and_analyze(
|
||||
&sema,
|
||||
original_file.syntax().clone(),
|
||||
|
@ -728,7 +728,7 @@ impl<'a> CompletionContext<'a> {
|
|||
)?;
|
||||
|
||||
// adjust for macro input, this still fails if there is no token written yet
|
||||
let scope = sema.scope_at_offset(&token.parent()?, offset)?;
|
||||
let scope = sema.scope_at_offset(&token.parent()?, original_offset)?;
|
||||
|
||||
let krate = scope.krate();
|
||||
let module = scope.module();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue