We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
According to OmniSharp/omnisharp-roslyn#1581 then codeActionsOnSave should be able to fix issues on save.
codeActionsOnSave
"editor.codeActionsOnSave": { "source.fixAll.csharp": true }
But I can't get it to remove unnecessary imports on save. I can however run the fixes manually via the command palette.
I've included the OmniSharp log for running these manually. Also why is there two for removing unused imports? And shouldn't the CS8019 be IDE0005?
I have the following settings:
"[csharp]": { "editor.codeActionsOnSave": { "source.fixAll.csharp": true } }, "omnisharp.enableEditorConfigSupport": true, "omnisharp.enableRoslynAnalyzers": true, "omnisharp.organizeImportsOnFormat": true
organizeImportsOnFormat does work, so something is working :)
organizeImportsOnFormat
Add an unused import statement, like using System.Buffers;. Then save.
using System.Buffers;
using System.Buffers; should be removed.
using System.Buffers; isn't removed.
VSCode version: 1.53.2 C# Extension: 1.23.9
Runtime Environment: OS Name: Windows OS Version: 10.0.19041 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.101\
Host (useful for support): Version: 5.0.1 Commit: b02e13abab
.NET SDKs installed: 2.2.401 [C:\Program Files\dotnet\sdk] 3.1.404 [C:\Program Files\dotnet\sdk] 5.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Issue Description
According to OmniSharp/omnisharp-roslyn#1581 then
codeActionsOnSave
should be able to fix issues on save.But I can't get it to remove unnecessary imports on save.
I can however run the fixes manually via the command palette.
I've included the OmniSharp log for running these manually.
Also why is there two for removing unused imports?
And shouldn't the CS8019 be IDE0005?
I have the following settings:
organizeImportsOnFormat
does work, so something is working :)Steps to Reproduce
Add an unused import statement, like
using System.Buffers;
. Then save.Expected Behavior
using System.Buffers;
should be removed.Actual Behavior
using System.Buffers;
isn't removed.Logs
OmniSharp log
C# log
Environment information
VSCode version: 1.53.2
C# Extension: 1.23.9
Dotnet Information
.NET SDK (reflecting any global.json): Version: 5.0.101 Commit: d05174dc5aRuntime Environment:
OS Name: Windows
OS Version: 10.0.19041
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.101\
Host (useful for support):
Version: 5.0.1
Commit: b02e13abab
.NET SDKs installed:
2.2.401 [C:\Program Files\dotnet\sdk]
3.1.404 [C:\Program Files\dotnet\sdk]
5.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
Visual Studio Code Extensions
The text was updated successfully, but these errors were encountered: