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

C# code formatting ignoring EditorConfig settings #1726

Closed
aeschli opened this issue Aug 21, 2017 · 21 comments · Fixed by OmniSharp/omnisharp-roslyn#1526
Closed

C# code formatting ignoring EditorConfig settings #1726

aeschli opened this issue Aug 21, 2017 · 21 comments · Fixed by OmniSharp/omnisharp-roslyn#1526
Labels

Comments

@aeschli
Copy link
Contributor

aeschli commented Aug 21, 2017

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

@DustinCampbell
Copy link
Member

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

@rchande
Copy link

rchande commented Oct 6, 2017

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

@DustinCampbell
Copy link
Member

I bet we won't 😄

@rchande
Copy link

rchande commented Oct 6, 2017

I'm curious, why not?

@DustinCampbell
Copy link
Member

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.

@jasonmalinowski
Copy link
Member

jasonmalinowski commented Oct 13, 2017

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.

@DustinCampbell
Copy link
Member

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

@jasonmalinowski
Copy link
Member

@DustinCampbell Sure!

@DustinCampbell
Copy link
Member

Loop in @rchande too.

@Nepoxx
Copy link

Nepoxx commented Nov 17, 2017

@rchande

once Roslyn finishes implementing editorconfig support for the compiler

Are there any plans for that?

@jinujoseph
Copy link

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

@StewMcc
Copy link

StewMcc commented Dec 14, 2017

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

@richardthombs
Copy link

When will this issue be fixed please?

@NTaylorMullen
Copy link
Contributor

This would be great to have.

@DustinCampbell
Copy link
Member

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.

@AnthonyMastrean
Copy link

@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?

@Alxandr
Copy link

Alxandr commented Mar 3, 2019

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

@kpko
Copy link

kpko commented Jun 7, 2019

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:

@jasonmalinowski
Copy link
Member

@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.

@guidobouman
Copy link

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.

@AnthonyMastrean
Copy link

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.