mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-03 21:25:25 +00:00
Merge pull request #18889 from ChayimFriedman2/subtle-completion
fix: Fix actual token lookup in completion's `expand()`
This commit is contained in:
commit
cc016df54b
1 changed files with 2 additions and 1 deletions
|
|
@ -123,10 +123,11 @@ fn expand(
|
||||||
) -> Option<ExpansionResult> {
|
) -> Option<ExpansionResult> {
|
||||||
let _p = tracing::info_span!("CompletionContext::expand").entered();
|
let _p = tracing::info_span!("CompletionContext::expand").entered();
|
||||||
|
|
||||||
|
// Left biased since there may already be an identifier token there, and we appended to it.
|
||||||
if !sema.might_be_inside_macro_call(&fake_ident_token)
|
if !sema.might_be_inside_macro_call(&fake_ident_token)
|
||||||
&& original_file
|
&& original_file
|
||||||
.token_at_offset(original_offset + relative_offset)
|
.token_at_offset(original_offset + relative_offset)
|
||||||
.right_biased()
|
.left_biased()
|
||||||
.is_some_and(|original_token| !sema.might_be_inside_macro_call(&original_token))
|
.is_some_and(|original_token| !sema.might_be_inside_macro_call(&original_token))
|
||||||
{
|
{
|
||||||
// Recursion base case.
|
// Recursion base case.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue