-
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
Code Actions do not respect formatting options #1191
Comments
Thanks for the report - this is indeed a bug, but it is not a regression. OmniSharp will absolutely try to detect your VS Code settings and apply accordingly, even without Can you also list your settings for (unless you use defaults):
|
All three of those are set to the default values (true, true and true) for me. I haven't changed them in either my user settings, my workspace settings, or my |
It looks to me like OmniSharp never sets the formatting options on its workspace, so features never automatically (like code actions) pick them up. |
Yes that's exactly what's happening. I'm thinking the best/most flexible way to go forward would be to create a MEF extensibility point in This would also simplify a lot of code, as at the moment the formatting endpoints keep creating the formatting settings over and over too. |
This issue was moved to OmniSharp/omnisharp-roslyn#759 |
Since all of the work will need to happen in omnisharp-roslyn, let's track it there. |
Environment data
dotnet --info
output:VS Code version: 1.9.0
C# Extension version: 1.6.2
Contents of
omnisharp.json
in root directory of my current project:Steps to reproduce
DoSomething();
Expected behavior
OmniSharp generates a method matching the indentation of the current file:
Actual behavior
The method is generated with spaces, even though the file is indented with tabs (which VS Code was able to auto-detect) and the
omnisharp.json
config file specified using tab indentation:Any new lines of code that I write in the file, though, will contain tab indentation since VS Code has (correctly) detected that the file contains tabs. (I actually prefer spaces for indentation myself, but the project's coding standards require tabs, so that's what I'm using for this project).
Workaround
I can work around this by selecting the newly-created method, hitting Shift-Tab once to dedent it (which causes VS Code to convert its indentation to spaces), then hitting Tab once to indent it again, which adds a tab as it moves back to its original indentation. But I'd rather see OmniSharp detect the current indentation style of the file and match it -- or, failing that, at least respect the
omnisharp.json
settings.Related bugs
The part where I say "I'd rather see OmniSharp detect the current indentation style of the file and match it" might be a completely new feature request, but the part where the
omnisharp.json
settings file seems to be ignored looks like it might be a regression of #834 and/or #927. Also, PR #1055 might be related.The text was updated successfully, but these errors were encountered: