Giter VIP home page Giter VIP logo

Comments (9)

pflannery avatar pflannery commented on June 18, 2024

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?

from vscode-csharp.

TJSoftware avatar TJSoftware commented on June 18, 2024

@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

from vscode-csharp.

pflannery avatar pflannery commented on June 18, 2024

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

from vscode-csharp.

TJSoftware avatar TJSoftware commented on June 18, 2024

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

from vscode-csharp.

pflannery avatar pflannery commented on June 18, 2024

@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

from vscode-csharp.

TJSoftware avatar TJSoftware commented on June 18, 2024

@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

from vscode-csharp.

TJSoftware avatar TJSoftware commented on June 18, 2024

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

from vscode-csharp.

TJSoftware avatar TJSoftware commented on June 18, 2024

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 👍

from vscode-csharp.

filipw avatar filipw commented on June 18, 2024

This has been fixed with #1055

from vscode-csharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.