1

While writing some C# I noticed that the editor is suggesting to replace all my var statements with the actual type. How do I turn this off?

I've gone through the all the options for the text editor and disabled them. I've uninstalled the copilot extension. Is it something to do with the C# dev kit? If so where do I even find these settings?

Here are all the options i've disabled inside vs code.

  • Accept Suggestion On Commit Character is disabled.
  • Accept Suggestion On Enter is set to off.
  • Inline Suggest › Edits: Allow Code Shifting is set to never.
  • Inline Suggest › Edits: Render Side By Side is set to never.
  • Inline Suggest › Edits: Show Collapsed is disabled.
  • Inline Suggest: Enabled is disabled.
  • Inline Suggest › Experimental: Empty Response Information is disabled.
  • Inline Suggest › Experimental: Show On Suggest Conflict is set to never.
  • Inline Suggest › Experimental: Suppress Inline Suggestions is empty.
  • Inline Suggest: Suppress In Snippet Mode is enabled.
  • Inline Suggest: Suppress Suggestions is enabled.
  • Inline Suggest: Syntax Highlighting Enabled is disabled.
  • Inline Suggest: Trigger Command On Provider Change is disabled.
  • Quick Suggestions all items are set to off.
  • Screen Reader Announce Inline Suggestion is disabled.
  • Snippet Suggestions are set to none.
  • Suggest: Filter Graceful is disabled.
  • Suggest: Insert Mode is set to insert, I can't set it to nothing.
  • Suggest: Locality Bonus is disabled
  • Suggest: Match On Word Start Only is disabled.
  • Suggest: Preview is disabled.
  • Suggest: Selection Mode is set to never.
  • Suggest: Share Suggest Selections is disabled.
  • Suggest: Show Classes is disabled.
  • Suggest: Show Colors is disabled.
  • Suggest: Show Constants is disabled.
  • Suggest: Show Constructors is disabled.
  • Suggest: Show Customcolors is disabled.
  • Suggest: Show Deprecated is disabled.
  • Suggest: Show Enum Members is disabled.
  • Suggest: Show Enums is disabled.
  • Suggest: Show Events is disabled.
  • Suggest: Show Fields is disabled.
  • Suggest: Show Files is disabled.
  • Suggest: Show Folders is disabled.
  • Suggest: Show Functions is disabled.
  • Suggest: Show Icons is disabled.
  • Suggest: Show Inline Details is disabled.
  • Suggest: Show Interfaces is disabled.
  • Suggest: Show Issues is disabled.
  • Suggest: Show Keywords is disabled.
  • Suggest: Show Methods is disabled.
  • Suggest: Show Modules is disabled.
  • Suggest: Show Operators is disabled.
  • Suggest: Show Properties is disabled.
  • Suggest: Show References is disabled.
  • Suggest: Show Snippets is disabled.
  • Suggest: Show Status Bar is disabled.
  • Suggest: Show Structs is disabled.
  • Suggest: Show Type Parameters is disabled.
  • Suggest: Show Units is disabled.
  • Suggest: Show Users is disabled.
  • Suggest: Show Values is disabled.
  • Suggest: Show Variables is disabled.
  • Suggest: Show Words is disabled.
  • Suggest: Snippets Prevent Quick Suggestions is disabled.
  • Controls whether an active snippet prevents quick suggestions.
  • Suggest On Trigger Characters is disabled.

I've also tried with .editorconfig but I'm not too sure if this is right - this is at the root of the project:

root = true

[*.cs]
dotnet_diagnostic.IDE0008.severity = none
dotnet_diagnostic.IDE0007.severity = none

[*.razor]
dotnet_diagnostic.IDE0008.severity = none
dotnet_diagnostic.IDE0007.severity = none

Doesn't seem to be doing anything either.

2
  • The rules seems to be the correct ones. I don't use VS-Code, have you tried other options (e.g. disabling them in project-file)? Check this topic too, there seems to be extension for VS-Code. Commented Nov 10 at 14:35
  • Yes, I tried doing it with the extension to generate the editorconfig. No luck. Enabling OmniSharp fixed the problem for me so I'm sticking with that. If somebody wants to figure out why it otherwise ignores the editorconfig and all the disabled options they are free to do so. Commented Nov 10 at 15:03

1 Answer 1

1

After some more messing around it seems like the C# by Microsoft extension was causing the issue.
Reading the extension i saw this:

How to use OmniSharp?

If you don’t want to take advantage of the great Language Server features, you can revert back to using OmniSharp by going to the Extension settings and setting dotnet.server.useOmnisharp to true. Next, uninstall or disable C# Dev Kit. Finally, restart VS Code for this to take effect.

After I did that it no longer caused the vars to be replaced.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.