Omnisharp-vscode: C# code formatting ignoring EditorConfig settings

Created on 21 Aug 2017  路  21Comments  路  Source: OmniSharp/omnisharp-vscode

_From @michaldudak on August 18, 2017 11:47_

Format selection / Format document commands seem to ignore the current EditorConfig settings when applied to a C# file.

I'm not sure if this repo is the right place for to log the issue. Please correct me if it should be elsewhere.

  • VSCode Version: Code 1.15.1 (41abd21afdf7424c89319ee7cb0445cc6f376959, 2017-08-16T18:05:38.342Z)
  • OS Version: Windows_NT ia32 10.0.15063
  • Extensions:

Extension|Author (truncated)|Version
---|---|---
path-intellisense|chr|1.4.2
gitignore|cod|0.5.0
vscode-svgviewer|css|1.4.2
vscode-eslint|dba|1.2.11
githistory|don|0.2.3
EditorConfig|Edi|0.9.4
auto-rename-tag|for|0.0.14
vscode-flatland-icon-theme|geb|0.0.6
vscode-auto-open-markdown-preview|hnw|0.0.4
icon-fonts|idl|1.8.0
vscode-angular2-emmet|jak|2.0.3
Angular2|joh|2.4.0
vscode-less|mrm|0.6.3
csharp|ms-|1.12.1
PowerShell|ms-|1.4.1
typescript-javascript-grammar|ms-|0.0.23
vs-keybindings|ms-|0.1.7
sass-indented|rob|1.4.1
autoimport|ste|1.2.2

(2 theme extensions excluded)


Steps to Reproduce:

  1. Have the following .editorconfig file in a directory:
    ```
    root = true

[*]
indent_style = tab
````

  1. Create a new C# file indented with tabs
  2. Run Format Document command on it
  3. See that tabs were converted to spaces.

One thing to note - "omnisharp.useEditorFormattingSettings" is set to true in my configuration.


Reproduces without extensions: No

_Copied from original issue: Microsoft/vscode#32776_

Backlog

Most helpful comment

Is there any upstream issue from roslyn to add support for editorconfig that's trackable anywhere?

All 21 comments

EditorConfig support has not been added for C# for VS Code. I'll use this project to track adding this feature in the future.

I bet we'll get a lot of this for free once Roslyn finishes implementing editorconfig support for the compiler (cc @jasonmalinowski @jinujoseph)

I bet we won't :smile:

I'm curious, why not?

I'm just betting on it not working based on looking at editorconfig in the past and finding that everything was completely internal. How would it get into the OmniSharpWorkspace? Just because it would be passed into the compiler doesn't mean it would make it's way into our workspace options automatically.

Well, it should Just Work because if it doesn't, you can yell at us to finish the job. 馃槈 Given we have to support in the same API the command line compiler, the VS inproc and out of proc workspaces...we have to design it flexibly.

@jasonmalinowski : Could you loop me in to that design work? I'd like to make sure it meets our needs.

@DustinCampbell Sure!

Loop in @rchande too.

@rchande

once Roslyn finishes implementing editorconfig support for the compiler

Are there any plans for that?

yes @Nepoxx
This has been in our Wish list for a while Link

Is there a workaround for this atm, other than disabling the plugin?

When will this issue be fixed please?

This would be great to have.

The work on the Roslyn side to integrate .editorconfig support into the compiler is not yet complete, but is in progress. This is necessary before we can make this work in C# for VS Code.

@DustinCampbell Am I right, based on this comment, that you're tracking EditorConfig support here? If so, is there any chance that you'll be working toward the extended list of .NET coding conventions that Visual Studio supports?

Is there any upstream issue from roslyn to add support for editorconfig that's trackable anywhere?

Hi everyone, doesn't Roslyn already support pulling configuration from .editorconfig via https://github.com/dotnet/roslyn/blob/master/src/Workspaces/Core/Portable/Options/EditorConfig/EditorConfigDocumentOptionsProviderFactory.cs in Workspaces?

See also:

@kpko Yes, that's the proper support we're building. We're starting to test that internally and work through a few other design issues before we call that good.

Nice that this is merged in the omnisharp-roslyn package, but when can we expect this in VS Code? Until the feature works in this repo, I would not really consider this closed.

@guidobouman this is like the last challenge of using GitHub issues... I don't care when it's closed, I care when it's released!

Was this page helpful?
0 / 5 - 0 ratings