-
Notifications
You must be signed in to change notification settings - Fork 790
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
Fix completion with backticks, underscores, numbers #10500
Conversation
vsintegration/src/FSharp.Editor/Completion/CompletionService.fs
Outdated
Show resolved
Hide resolved
I've changed it to use the Tokenizer directly, so that it can easily handle multiple backticks, backticks in strings, etc. Unfortunately it turns out the rest of the completion pipeline is not as robust. E.g. something like I'll play around some more to see if feasible to update, otherwise maybe it's ok to leave some edge cases if the majority of typical cases work. |
I agree. I'm happy to review with aims to take this as is provided that tests pass. Just let me know if you want to proceed with that or hold off until you're finished experimenting a little more. |
Ok I'll skip digging into the rest of the pipeline for now so this can move forward. |
Thanks! Mind marking this as no longer WIP? Then we can review. |
Ready to go, hopefully the test structure is ok, made it a separate utility function. |
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.
This is great, thanks! Will merge subject to CI passing.
Wonderful work! Since specifically for awkward names, completion is a must have, and removing redundant words or backticks was quite a pain. Very happy you solved this!! |
This is to address the following issues:
Which are also listed in this issue:
Before PR:
After PR:
The problem (if I traced the right code) is that the default logic (erroneously?) only captures identifier-start characters to the left of the cursor, and further defines start characters as letters only.
https://github.com/dotnet/roslyn/blob/823039e98e56e527d40b4fbcb6bf9755ce02855c/src/Features/Core/Portable/Completion/CompletionService.cs#L102
C# overrides this to include identifier-part characters so I've used the same logic here, this handles underscores and numbers.
For backticks, my initial code shows it can work but is not ready for primetime. Simple character matching isn't enough to properly restrict the range especially in the case of partial entry. As in
let x = (``typing here... , ``already-typed``)
, how to know it shouldn't include the comma? Is this an already-considered scenario somewhere in the existing tooling codebase? I'd appreciate any guidance or pointers to help with this.