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

csharp: Shift+Alt+F not honouring "editor.tabSize": 2 #24

Closed
jrieken opened this issue Jan 28, 2016 · 9 comments
Closed

csharp: Shift+Alt+F not honouring "editor.tabSize": 2 #24

jrieken opened this issue Jan 28, 2016 · 9 comments
Assignees
Milestone

Comments

@jrieken
Copy link
Contributor

jrieken commented Jan 28, 2016

From @pflannery on January 27, 2016 12:50

v0.10.6
Executing Shift+Alt+F in a csharp file always defaults to a tab size of 4 regardless of my editor.tabSize preference.
But pressing tab in a csharp file does honour my tab size preference.

Also Shift+Alt+F works in javascript files.

Copied from original issue: microsoft/vscode#2439

@pflannery
Copy link

Thanks this has led me to find a work around for now. Relates with OmniSharp/omnisharp-roslyn/issues/366

So adding an omnisharp.json file to the root of the working folder in vs code lets me control some basic formatting.

omnisharp.json content:

{
  "FormattingOptions": {
    "useTabs": false,
    "tabSize": 2,
    "indentationSize": 2,
    "smartIndent": 2,
    "newLine": "\n"
  }
}

Do you know if there is way I can also specify the CSharpFormattingOptions too?

@TJSoftware
Copy link

@jrieken Thank you for keeping my issue current with the multiple submissions in different repos.

I tested this workaround and I am unable to get it to work for me. I tried placing the omisharp.json file in the root as well as in the .vscode directory. Here is a screenshot of my test. My cs class has 4 spaces and the tab size is setup to be 2. I removed the custom bindings to match Visual Studio so I only need to press Shift + Alt + F. Here is a screenshot of my current test.

image

@pflannery
Copy link

@TJSoftware one extra thing that has to be done is to restart vs code after creating the omnisharp.json file.

@TJSoftware
Copy link

@pflannery Yes, I had done that, just in case I did it again. I still have the same results. I tested this on both my host and vm machines. They are both Windows 10 pro. I rebooted the vm just for fun, still no change.

@pflannery
Copy link

@TJSoftware looking again at your screen shot it might be that the "editor.tabSize" is set to 4 in your user\workspace settings. In your screen shot I can see 4 spaces from left but only two spaces once inside the c# class block.
Add some properties and methods to the class and test the format command. To remove the initial first four space issue then set "editor.tabSize" to 2.

image

@TJSoftware
Copy link

@pflannery I actually tried both the workspace and the user settings before. My original submission is here. I double checked to make sure my current settings have this. Here is another screenshot with relevant settings. I am still seeing issues with the format in C#. I also mentioned that I am seeing the same issue in XML, a non MS person said that was not supported, however I was using a StackOverflow post from @jrieken as a reference. I am not sure if it is supported or not. The tabs format as expected for JS and JSON.

image

@TJSoftware
Copy link

I just noticed an update notification on VSCode. I ran that and I still see the issues.

I also noticed something else strange. The version info shows that I am on node.4.1.1, if I look at cmd prompt I see node is 5.2.0.

image
image

@TJSoftware
Copy link

I tested with the same settings as before in the latest insider.

image

The results are the same, formatting works in json but not in C#. I was mainly just playing with the insider build, I did not expect that this would be fixed as it is still open.

Node still shows as 4.1.1

image

P.S. thanks for sharing the insider builds 👍

@filipw
Copy link
Contributor

filipw commented Jan 26, 2017

This has been fixed with #1055

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

5 participants