When typing "too fast", HTML element completions are omitted
Version: 17.9.0 P2
You can see my 3 attempts of typing <form in the recording:
- Successful, both HTML and Razor completions are present
- Successful, both HTML and Razor completions are present
- Failed, only Razor completions are present and missing all HTML completions
https://github.com/dotnet/razor/assets/9047283/adfcad46-d666-4d78-ada6-bc4cdca73cdb
Note that even after slowing down typing, HTML completions do not appear anymore in this completion session.
I encounter this issue all the time while developing Blazor. Look at this, I'm trying to simply open a <dl> tag, but if I don't spell it slowly, I get the wrong completion:
https://github.com/dotnet/razor/assets/9047283/cb13c724-fa8e-4ca9-aa6d-501b9c9427e6
Razor Logger Output:
11:45:22.325 We are behind the C# version which is surprising. Could be an old request that wasn't cancelled, but if not, expect most future requests to fail. We were wanting 383 but C# is at 387.
The issue of typing a HTML tag fast, and pressing tab to accept the 1st intellisense item, and getting the wrong tag put in happens regularly for me in .cshtml files. It's so annoying. After it happens, most of the time it won't repeat the problem for that same tag at that same editor location, meaning it works after erasing it and re-typing/tabbing. But sometimes after it happens and I erase and slowly re-do it, I can see that intellisense doesn't have that item in the list, and I have to type the full thing without being able to press tab.
This happens even more regularly for HTML attributes. For example, I have a div tag and I type sty then press tab, and style isn't in the intellisense list, so it puts the 1st one it has into the code which is something other than style. Erasing then slowly typing sty will usually work fine.
I'm almost certain, but not 100% sure, it happens when the preview feature HTML LSP-based Editor is both enabled and disabled.
Reported here too: https://www.reddit.com/r/Blazor/s/g61LU8V68q
Quite often when I'm editing a .cshtml file I routinely get elements I'm typing overwritten by a completely unrelated element when I press space. @davidwengier was kind enough to point me to a temporary solution by disabling auto complete after space. However, this is not a real solution to the issue.
This particular issue seems like it's probably related. Here is an example of me typing <a and seeing the unrelated elements in the select list. Of course when I press space it gets replaced with <cache.