-
Notifications
You must be signed in to change notification settings - Fork 420
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
Added support for organizing imports in formatting #1686
Conversation
Would it be good to have this functionality split the way VS does, Format vs Code Cleanup? The format command defaulting to just being whitespace formatting. Then a new code cleanup command which brings in other types of changes such as organize imports. If the user always wanted the code cleanup behavior, then maybe there is an omnisharp option to run code cleanup during format. |
yes we could have another endpoint for this and then build it up with other capabilities to fix i.e. the IDExxxx diagnostics and so on. the reason why I added it to formatting endpoint here is that in LSP there is only the "formatting" concept, no "cleanup" concept, so I thought maybe that would be cleaner to not create something completely new. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@JoeRobich thanks for the approve. I really think it makes sense this way. in the "clean up" endpoint we could implement a more sophisticated handling like the current fix usings does already where it also removes unused stuff. It really also aligns with the feature discussed here #1581 by the way, do you currently call/plan to call this |
We do. We plan to make it part of the "style" formatting which would also include running analyzers and code fixes. This work is hinging on getting changes into Roslyn for it to setup workspaces to automatically make use of the compiler's EditorConfig support and for Analyzers to pull their configuration Options from the AnalyzerConfigOptions instead of relying on a Workspace OptionSet. |
OK very cool, then we will do the same in the future 😃 we need to change EditorConfig implementation to get support for dotnet_diagnostic severity control too. |
Hi, Is this actually live in 1.21.10 as it says in the release notes? Is there documentation for this feature anywhere, cuz i have a few questions:
Thanks, |
The organize imports formatting feature is now public in Roslyn.
Added as a flag since we have an approach to make all these things configurable and opt-in.