-
Notifications
You must be signed in to change notification settings - Fork 676
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
Override code generation not working #4600
Override code generation not working #4600
Comments
I could try, but a precise set of instructions for reproducing the issue and your omnisharp logs are likely going to be the only way to make progress here. |
Same problem. Override sometimes stops working. Moreover, it can work now, stop working in two minutes, and start working again in three minutes, some kind of madness. Previously, everything worked fine, but lately I see this more and more often. |
Your conversation about spaces and tabs helped me find the reason. Override unexpectedly requires proper indentation o.O I often do three enter and up arrow for a new method. As a result, the up arrow takes me not to the class level, unlike enter, but to the beginning of the line, I immediately write override (since I see no reason to add indentation, which will be fixed anyway) and it does not work. |
@DArkHekRoMaNT I'm still looking for a way to reproduce this. If you have info, please let me know. |
I've noticed this mysterious behaviour too - after some trial and error I realised it's not triggered by just any trailing whitespace anywhere, but for some reason it really hates trailing tab on class-scope opening brace. Tried this in omnisharp-roslyn repo it goes together with these logs:
|
Seems to work for me as long as I start typing
|
LSP filters expect that the range of the main text edit is going to start on the same line as the cursor. However, when trailing whitespace preceeds the override marker, Roslyn will return a single text edit for the whole range that trims that whitespace. This confuses the vscode intellisense engine, which then unhelpfully displays no completions with no user feedback that this filtering is happening. To avoid this, we now detect when this case occurs, and split up the change into non-overlapping edits from before the current line. Fixes dotnet/vscode-csharp#4600.
Thanks for the help @SirIntruder, I was able to reproduce from your pictures, and have a bug fix in OmniSharp/omnisharp-roslyn#2319. @ddavisso4, I don't think this addresses the issue you mentioned: I didn't see anything about an ArgumentOutOfRange exception in the repro for this bug. If you encounter that again, please file a separate issue with a set of instructions on how to reproduce it. |
Issue Type: Bug
If there is a trailing white space ANYWHERE in a class, the override code generation will not work.
https://gyazo.com/be89e3cb0b6ffe9a86697ba1f5d0406e
Extension version: 1.23.12
VS Code version: Code 1.56.2 (054a9295330880ed74ceaedda236253b4f39a335, 2021-05-12T17:13:13.157Z)
OS version: Windows_NT x64 10.0.19042
The text was updated successfully, but these errors were encountered: