VSCode Omnisharp ignores format settings in omnisharp.json

Viewed 146

I've been working on a project in Unity for months now and have been using Omnisharp to format C# code. Just today, the formatter started formatting my code differently than before and I don't know why.

The only thing I've noticed that is different is the inserting of a new line before braces in class and method definitions, if/then statements, and loops. Before, I had it configured to format all of those things like this:

enter image description here

Now suddenly today they're all being formatted like this:

enter image description here

With a new line after the Start() and before the opening curly brace. The omnisharp.json file at the root of the project looks like this:

enter image description here

I haven't changed it since starting to work on this project. I would like to know why the formatter seems to suddenly ignore the NewLine... settings. Intellisense is still working and files are indeed being formatted, just not in a way that matches the settings I have configured.

I tried changing indentationSize to 4 in the omnisharp.json and restarted Omnisharp. That worked and made it indent 4 spaces. So it seems the formatter is getting something from my omnisharp.json, but it's just ignoring all the NewLine... settings when it wasn't before.

It's not a huge deal, it's just a little annoying to have my code being formatted differently than it has been all this time, and more annoying to not know why that's happening.

1 Answers

Go to settings.json and remove "omnisharp.path": "latest" if you have it, this fixed the issue for me make sure to restart omnisharp after by pressing ctrl+shift+p and type restart omnisharp

Related