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
Inline completion preselection of intellisense items doesn't work if it includes a closing brace which is in the document. #135440
Comments
Thanks for the detailed issue and your investigation! I thought
But the semicolon that your suggestions appends after the parenthesis prevents this from working.
Hmm, I have to admit that I don't fully understand the consequences of this and why that is the right thing to do (though I see that it would help in this case). Maybe, for now, VS Code should just check if the suggestion range is a "prefix" of the inline suggestion range, i.e. same start, but the end of the suggestion range must be less than or equal to the end of the inline suggestion range. Long-term, the diffs should be computed first. |
I'm not really sure what the consequences of this are, since I'm not familiar with any of the surrounding code- it just seemed like a reasonable solution to propose to open the conversation with.
This seems OK to me. There aren't any counterexamples jumping out at me that would break this.
I'm not sure I understand this - is the idea to compute the diffs of the suggestion & inline suggestions, and then see if the suggestion's diff is somehow a subset of the inline suggestion's diff? |
Please let me know if the fix is valid (should be available in tomorrows insider build)! |
@hediet , sorry for the >2 week delay in validating the fix, but I found that it didn't work for me. I made this change locally which fixed it: I assume the range to test should always be as long as or longer than the prefix that it may start with. Does that make sense? |
@vivlimmsft sorry for that. Can you test it again in Mondays insider build? |
@hediet Looks good. Thanks! |
Does this issue occur when all extensions are disabled?: Yes/No (because I would not get any inline completions)
Steps to Reproduce:
(thanks @lostintangent for providing this repro gif, using this file)
I dug into this a bit and found that the ranges that the inline completion item and intellisense item are applying to differ.
At this location:
I saw these watch values:
the second condition, that the beginning of the text matches, is true. the condition that the range matches is false, because the endColumn is 53 and 54.
the 53rd character on this line is the trailing )
so my guess of why they differ is that the inline completion range overlaps character 53 because the completion includes the closing paren which is already in the document.
@hediet , can the condition used to match inline suggestions to intellisense items be relaxed here, perhaps only requiring the
startLineNumber
s andstartColumn
s to match?( cc @juihanamshet1 and @ayim )
The text was updated successfully, but these errors were encountered: