Comments (9)
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.
@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.
from vscode-csharp.
@TJSoftware one extra thing that has to be done is to restart vs code after creating the omnisharp.json file.
from vscode-csharp.
@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.
@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.
from vscode-csharp.
@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
.
from vscode-csharp.
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.
from vscode-csharp.
I tested with the same settings as before in the latest insider.
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
P.S. thanks for sharing the insider builds 👍
from vscode-csharp.
This has been fixed with #1055
from vscode-csharp.
Related Issues (20)
- Support internal/external terminal for web projects HOT 3
- Group Nuget Files Under Nuget Directory in Solution Explorer
- Simplify name of attach to process command HOT 9
- View template generations
- Solution Explorer should support moving files
- Support switching target frameworks
- Indentation doesn't seem to take the braces into account HOT 2
- Brace completion doesn't take existing end brace into account
- Parameter help doesn't work inside of lamdas
- Reordering classes, methods and so on using Outline window
- C# Dev Kit LSP "'end' must not be less than 'start'"
- Option to disable implicitly adding `using` directives HOT 4
- C# code analysis fails to initialize with error `System.ArgumentException: filePath` HOT 1
- Request codeLens/resolve failed in git diff HOT 2
- Auto doc comment generation and other formatOnType features broken HOT 9
- Request textDocument/foo failed HOT 10
- Creating a new class under a folder in Solution Explorer does not give the class correct namespace HOT 2
- Iteration Plan for June 2024
- Please default to P2P reference HOT 1
- Standardize UI Navigation with `workbench.action.navigate` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-csharp.