remove unused usings
See original GitHub issueEnvironment data
dotnet --info
output:
.NET Command Line Tools (1.0.0-preview2-003131)
Product Information:
Version: 1.0.0-preview2-003131
Commit SHA-1 hash: 635cf40e58
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
VS Code version: 1.9.1 C# Extension version: 1.7.0
Steps to reproduce
Search in Command Palette for “Remove Unused Usings” or “Remove Unnecessary Usings” command.
Expected behavior
Option to “Remove Unused Usings” or “Remove Unncessary Usings” is available in Command Palette. Executing the command will remove all unnecessary usings from the active .cs file.
Actual behavior
No feature exists.
Expecting a feature like this (from VS 2015):
This issue seems very similar to #788 but I think removing unused usings is a much different feature from sorting. Removing usings prevents code warnings, shortens code, etc.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:30
- Comments:17 (6 by maintainers)
Top Results From Across the Web
Quick Tip - Remove Unused Using References in Visual Studio
First is putting your cursor on one of the grayed out lines and clicking the light bulb, then clicking Remove Unnecessary Usings.
Read more >Clean Up & Sort Unused .NET Using Statements in Visual ...
Clean Up & Sort Unused .NET Using Statements in Visual Studio · The easiest way to find anything in Visual Studio is click...
Read more >Remove unused directives (or "usings") with Code Cleanup ...
Hey there,. I'd like to let Resharper cleanup unused usings/directives from files, during Code cleanup, on file saving.
Read more >Remove and Sort – Namespaces using Shortcut in Visual Studio
From Tools > Option , navigate to Keyboard tab. Search for “Edit.RemoveAndSort” which command will to both remove unused usings and sort the...
Read more >Remove unused references - Visual Studio (Windows)
How-to · Right click on a project name or dependencies node in Solution Explorer. · Select Remove Unused References. Remove Unused References ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
it is already implemented.
press
ctrl+p
(cmd+P
on a Mac), select the optionOmniSharp: Fix all occurrences of a code issue within a project
(there are additional options for document/solution level too). All fixable issues from the given scope should show up - so selectCS8019: Unnecessary using directive
.Bump!.. This reasonably basic capability is a big miss on Visual Studio Code. I’m so used to having this from VS2017 and before and when you have loads of .cs files and many have a lot of using statements there is no way to cull the list without a majorly time-consuming effort.
Please can we have the capability to remove unused using statements - either through keyboard shortcut or through document formatting.