-
Notifications
You must be signed in to change notification settings - Fork 36
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
Make var
explicit/implicit
#72
Comments
Isn't that already covered with omnisharp in .editorconfig rules? I'm guessing you'd want something like this: csharp_style_var_elsewhere = false:warning
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion To ensure messages / warnings are created, and have vscode still running smoothly, I had to add an omnisharp.json to the root of my solution with the following contents: {
"RoslynExtensionsOptions": {
"EnableAnalyzersSupport": true
},
"FormattingOptions": {
"EnableEditorConfigSupport": true
}
} And I added these to my vscode settings: "omnisharp.enableAsyncCompletion": true,
"omnisharp.enableRoslynAnalyzers": true, |
Oh neat, I hadn't come across that particular rule! Thanks. 👍 In the case that a person isn't using enforced rules though, it would still be nice to be able to flip back and forth between |
Editorconfig rules can be enforced, can't they? At least via Pull Requests etc, but it should be possible via git hooks. |
In order to coordinate with the styleguide on my team, it's often necessary to convert
var
s in my code to explicit types and vice versa, that I don't always get right on my first try.It would be very useful to have a quickfix for toggling this.
Desired behaviour: If the cursor is over a
var
type in a declaration, pressingctrl + .
will offer to make its type explicit.(I see that the reverse, turning an explicit type into var, is already being offered by something, the Microsoft C# extension I think.)
The text was updated successfully, but these errors were encountered: