Skip to content
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

Settings from .editorconfig not respected by OmniSharp formatting #1765

Closed
Iron-E opened this issue Apr 14, 2020 · 3 comments
Closed

Settings from .editorconfig not respected by OmniSharp formatting #1765

Iron-E opened this issue Apr 14, 2020 · 3 comments

Comments

@Iron-E
Copy link

Iron-E commented Apr 14, 2020

Problem

In several editors, I have had issues with OmniSharp-Roslyn ignore the settings of my ".editorconfig". I have tried using it in Neovim (with OmniSharp-Vim, and in VSCode with OmniSharp-VSCode. In both editors, the settings of that file are completely ignored.

Steps to Reproduce

  1. Take a sample ".editorconfig" file, such as this:
    [*.cs]
    csharp_indent_braces = false
  2. Take some code, such as this:
    int foo = 0;
    switch (foo)
    {
    	case 0:
    	{
    		// some code here
    	}
    }
  3. Format the code using the editor of your choice, and you will see this:
    int foo = 0;
    switch (foo)
    {
    	case 0:
    		{
    			// some code here
    		}
    }

Note that this happens despite the csharp_indent_braces = false rule in the ".editorconfig" file.

@filipw
Copy link
Member

filipw commented Apr 14, 2020

did you enable editorconfig support? it's off by default in OmniSharp

@Iron-E
Copy link
Author

Iron-E commented Apr 14, 2020

There's no mention anywhere of there being a configuration option for turning editorconfig support on or off in any of the documentation.

See the README, Configuration Options, and, Using OmniSharp pages.

I had to search the issues to find that there is an option "EnableEditorConfigSupport". Upon enabling it, things work as expected. I feel like it should be mentioned in at least one of the documents I listed previously, though. How did the person in the issue discover it? Was it in the documentation before, but it was accidentally removed?

@filipw
Copy link
Member

filipw commented Apr 14, 2020

It's in the release notes https://github.com/OmniSharp/omnisharp-roslyn/blob/master/CHANGELOG.md#1330---2019-07-01 and I blogged about it here https://www.strathweb.com/2019/07/editorconfig-support-in-omnisharp-and-c-extension-vs-code/ (it comes up on
top in google when searching for "omnisharp editorconfig").

But you are right, it should be included in the Wiki too.

I will close this issue since it works now - thanks.

@filipw filipw closed this as completed Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants