Skip to content

Commit cc016df

Browse files
authored
Merge pull request #18889 from ChayimFriedman2/subtle-completion
fix: Fix actual token lookup in completion's `expand()`
2 parents 2e234e3 + 0c77bce commit cc016df

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,11 @@ fn expand(
123123
) -> Option<ExpansionResult> {
124124
let _p = tracing::info_span!("CompletionContext::expand").entered();
125125

126+
// Left biased since there may already be an identifier token there, and we appended to it.
126127
if !sema.might_be_inside_macro_call(&fake_ident_token)
127128
&& original_file
128129
.token_at_offset(original_offset + relative_offset)
129-
.right_biased()
130+
.left_biased()
130131
.is_some_and(|original_token| !sema.might_be_inside_macro_call(&original_token))
131132
{
132133
// Recursion base case.

0 commit comments

Comments
 (0)