-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autocomplete: do adjust a completion range if it does not match the current line suffix #1507
Conversation
…urrent line suffix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes the issue where completions were needlessly hidden: myFunction(█) with the insert text being "one", false because the current line suffix ) was not present in the generated completion. However, we still adjusted the completion insertion range to include it.
I found cases where completion is still not showing up because of current line suffix 🤔
Is this something else that's unrelated to the current issue?
@abeatrix, great catch! I debugged your examples locally and found out that we change completion insert ranges in two places:
The second part doesn't care if the completion range already exists, so the logic in the post-processing call (1) does not affect the result. I feel that this is one of these cases we bumped into frequently in the last month: we have multiple places implementing parts of the same logic, and they are not explicitly connected, which causes customer-facing bugs because it's impossible to keep all these pieces in our heads. The codebase snowballs. We should spend time streamlining the completion processing logic to clarify where specific changes are expected on the codebase architecture level (e.g., having one place where we operate on completion insert ranges or having one place for multiline truncation). Setting clear boundaries based on the current implementation would help us move faster with less time spent debugging such cases. WDYT? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What you said makes a lot of sense to me but I'll defer to you and Philipp since you both know the code better than I do 😃 it sounds like my examples require additional follow-up work but shouldn't block what you fixed here?
Yeah, I'm working on it now and will add them to the diff in this PR. |
@valerybugakov sorry I spent too much time on the chat redesign pr and forgot to review this. Will do it first thing on Monday 🙇🏻♀️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix looks reasonable! TY! It's indeed concerning that we have two places where we expand the range, we should make the range
required with the completion item, that should help!
Context
myFunction(█)
with the insert text being"one", false
because the current line suffix)
was not present in the generated completion. However, we still adjusted the completion insertion range to include it.Test plan
Added unit tests.