XamlStyler icon indicating copy to clipboard operation
XamlStyler copied to clipboard

Option to remove unused namespaces

Open danielchalmers opened this issue 6 years ago • 6 comments

Not sure if this is outside the scope of the project, but having the option to remove unused namespaces could be a nice addition.

Edit.RemoveAndSort

danielchalmers avatar Mar 09 '18 00:03 danielchalmers

The solution shoud accept, that some custom markup extension can use the namespace. That means, that namespace can be used not only in node name, but also in some node attributes values

Saratsin avatar May 08 '19 07:05 Saratsin

After further review, we would like to move forward with adding this feature. We do think it should be an option that is disabled by default to avoid inadvertently deleting code without the developer realizing it. If we can tap into the Visual Studio command, that would be preferred, but we should also be able to implement it ourselves in the core extension code.

grochocki avatar Apr 29 '20 06:04 grochocki

a) I don't think this is a must-do b) @grochocki after 6 or 4 years, do you still want to add this?

Jay-o-Way avatar Dec 24 '23 22:12 Jay-o-Way

I agree that it is not a must have, but also that it would be nice to provide the option to save a click by invoking the built-in VS feature if possible.

grochocki avatar Dec 28 '23 06:12 grochocki

The original post shows this option as a separate context menu item. Is this expectation/intent/desire that this be:

  • functionality (controlled via a new setting--and off by default) that is executed as part of the standard formatting behaviour
  • something that can be triggered via a new content menu entry for an individual file
  • both

The first option is the easiest/quickest and doesn't introduce the complexities of adding support for different IDEs.

I'm assuming that changing the visuals of namespaces that are defined but not used is out of scope.

mrlacey avatar Jan 10 '24 10:01 mrlacey

The first option is the easiest/quickest and doesn't introduce the complexities of adding support for different IDEs.

Agreed. I don't think we'd add it as a new context menu entry as VS already puts it there. Unless I am missing something, the benefit to adding an option to XAML Styler would be to allow for a one-click cleanup vs. having to run both commands.

grochocki avatar Jan 15 '24 16:01 grochocki