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
Omnisharp ignores omnisharp.json settings while formatting in v1.25.1 #5446
Comments
Can you set the |
I am also experiencing this lack of respect for omnisharp.json formatting, and have reverted to 1.25.0. |
Here are the logs, I hope this helps. Under v1.25.0Starting OmniSharp server at 11/9/2022, 11:58:59 AM
Target: c:\Users\5803969\src\stitch
OmniSharp server started with .NET 6.0.403 Loaded OmniSharp.DotNetTest, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509 No solution files found in 'c:\Users\5803969\src\stitch' [actual responses removed as this was quite a load of text] Under v1.25.1Starting OmniSharp server at 11/9/2022, 12:00:33 PM
Target: c:\Users\5803969\src\stitch
OmniSharp server started with .NET 6.0.403 Loaded OmniSharp.Cake, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509 No solution files found in 'c:\Users\5803969\src\stitch' |
Thanks for posting the logs. Actually, there was a change in OmniSharp 1.39.2 where editorconfig is given higher priority over formatting options set via Because the extension enables editor config by default, this results in the behavior you experience. If you switch off editorconfig support ( However going forward, I think it would be best to move your formatting options to editorconfig file for a number of reasons (can be portable between editors, single place to manage formatting and diagnostics and so on). |
@filipw : Thank-you. This is working after adding |
Perfect that clears it up. I will set up up a |
Yes, I will definitely update this. The problem is that documentation is for the server, where editorconfig is disabled by default, so it's sort of correct by default. It's only once editorconfig is enabled, the behavior changed (which we must document). For now I added a quick note to the changelog/readme #5447 |
Perfect let's hope that clears up this issue for other users. |
I would have expected a setting like "Enable Editor Config Support" to fall back to omnisharp.json when there is no .editorconfig in the workspace, which the current implementation did not do. It seems inappropriate to make the default behavior break backwards compatibility in a patch release. |
Issue Description
Omnisharp does not respect the
omnisharp.json
files anymore under VS Code C# extensionv1.25.1
while it does forv1.25.0
.Steps to Reproduce
I use the omnisharp language server for among other formatting of my source code in VS Code. I have an
omnisharp.json
file in%USERPROFILE%/.omnisharp
. Also, for testing purposes I copied this file to my projects working directory.Steps:
Expected Behavior
I expected omnisharp to respect the formatting choices as present in the configuration file as it did every previous day.
Actual Behavior
It used the default configuration for formatting.
Workaround
I rolled back to the VS Code C# extension
v1.25.0
(which you can see in the logs below) and this fixed the issue. I do not know if some new settings are needed from my side maybe with the newomnisharp.useModernNet
or that something has gone awry with the included update to omnisharp1.39.2
.Logs
OmniSharp log
OmniSharp server started with .NET 6.0.403
.
Path: c:\Users\5803969.vscode\extensions\ms-dotnettools.csharp-1.25.0-win32-x64.omnisharp\1.39.0-net6.0\OmniSharp.dll
PID: 17164
Starting OmniSharp on Windows 10.0.19044.0 (x64)
info: OmniSharp.Services.DotNetCliService
Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
info: OmniSharp.Services.DotNetCliService
Using the 'dotnet' on the PATH.
info: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 2 MSBuild instance(s)
1: .NET Core SDK 6.0.403 17.3.2 - "C:\Program Files\dotnet\sdk\6.0.403"
2: .NET Core SDK 6.0.401 17.3.1 - "C:\Program Files\dotnet\sdk\6.0.401"
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: .NET Core SDK 6.0.403 17.3.2 - "C:\Program Files\dotnet\sdk\6.0.403"
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
info: OmniSharp.MSBuild.ProjectSystem
No solution files found in 'c:\Users\5803969\src\stitch'
info: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\Users\5803969\src\stitch\stitch\stitch.csproj'
info: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\Users\5803969\src\stitch\tests\tests.csproj'
info: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'c:\Users\5803969\src\stitch'.
info: OmniSharp.MSBuild.ProjectManager
Loading project: c:\Users\5803969\src\stitch\stitch\stitch.csproj
info: OmniSharp.Script.ScriptProjectSystem
Did not find any CSX files
info: OmniSharp.WorkspaceInitializer
Configuration finished.
info: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location 'c:\Users\5803969\src\stitch' on host 17916.
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\Users\5803969\src\stitch\stitch\stitch.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Adding project 'c:\Users\5803969\src\stitch\stitch\stitch.csproj'
info: OmniSharp.MSBuild.ProjectManager
Loading project: c:\Users\5803969\src\stitch\tests\tests.csproj
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\Users\5803969\src\stitch\tests\tests.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Adding project 'c:\Users\5803969\src\stitch\tests\tests.csproj'
info: OmniSharp.MSBuild.ProjectManager
Update project: stitch
info: OmniSharp.MSBuild.ProjectManager
Update project: tests
C# log
Environment information
VSCode version: 1.73.0
C# Extension: 1.25.0
Dotnet Information
.NET SDK (reflecting any global.json): Version: 6.0.403 Commit: 2bc18bf292Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.403\
global.json file:
Not found
Host:
Version: 6.0.11
Architecture: x64
Commit: 943474ca16
.NET SDKs installed:
3.1.425 [C:\Program Files\dotnet\sdk]
6.0.401 [C:\Program Files\dotnet\sdk]
6.0.403 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.31 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.31 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.31 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Download .NET:
https://aka.ms/dotnet-download
Learn about .NET Runtimes and SDKs:
https://aka.ms/dotnet/runtimes-sdk-info
Visual Studio Code Extensions
The text was updated successfully, but these errors were encountered: