vscode-csharp icon indicating copy to clipboard operation
vscode-csharp copied to clipboard

Please add 'Remove and Sort Usings'

Open arunchndr opened this issue 1 year ago • 6 comments

From vscode-dotnettools created by mmiller-d8: microsoft/vscode-dotnettools#982

Type: Feature Request

It would be really great if you had a 'Remove and Sort Usings' feature like in Visual Studio.

Extension version: 1.3.10 VS Code version: Code 1.87.0 (019f4d1419fbc8219a181fab7892ebccf7ee29a2, 2024-02-27T23:42:51.279Z) OS version: Darwin arm64 23.2.0 Modes:

arunchndr avatar Mar 18 '24 16:03 arunchndr

At the very least it'd be good to see the built-in roslyn language server detect unused usings (CS8019). This is a pretty big gap compared to O#.

jeremy-allocate avatar Aug 01 '24 20:08 jeremy-allocate

@jeremy-allocate If you are not seeing the Roslyn LSP report unused usings, please open a new issue and provide the requested logs and repro steps.

JoeRobich avatar Aug 02 '24 22:08 JoeRobich

@JoeRobich should that be opened in this repo, or https://github.com/dotnet/roslyn, or https://github.com/dotnet/roslyn-analyzers?

jeremy-allocate avatar Aug 02 '24 22:08 jeremy-allocate

Open it in this repo and we will transfer as necessary once we can repro.

JoeRobich avatar Aug 02 '24 23:08 JoeRobich

Done, https://github.com/dotnet/vscode-csharp/issues/7416.

jeremy-allocate avatar Aug 02 '24 23:08 jeremy-allocate

@arkalyanms I'd like to recommend an extension I currently maintain called C# Organize Usings. I forked csharp-format-usings, fixed all the bugs that were causing me issues with it, and just released support for the IDE0005 flavor of the warning that Roslyn uses (vs. CS8019). Hope you find it useful. I've configured it to run on save in combination with this extension, which has been working out great so far for my team.

If you try it, please let me know if you run into any problems that prevent you from using it.

jeremy-allocate avatar Aug 06 '24 16:08 jeremy-allocate