anzwdev / al-code-outline

AL Code Outline for Visual Studio Code
MIT License
51 stars 14 forks source link

[Feature Request] Code Cleanup: Sort Usings #586

Closed ChrisBlankDe closed 4 months ago

ChrisBlankDe commented 5 months ago

Would be nice to have an Clanup Action to Sort usings. Sorting can be alphabetically or logical (System., Microsoft., 3rd-Party)

Bad Code:

using System.Utilities;
using Microsoft.Utilities;
using AwesomeCorp.Feature;
using System.Text;
using System.Telemetry;

Good Code (alphabetically):

using AwesomeCorp.Feature;
using Microsoft.Utilities;
using System.Telemetry;
using System.Text;
using System.Utilities;

Good Code (logical):

using System.Telemetry;
using System.Text;
using System.Utilities;
using Microsoft.Utilities;
using AwesomeCorp.Feature;
anzwdev commented 4 months ago

Thank you for reporting your issue. There was a bug preventing this functionality from working. You can use "Sort Ysings in the Active Editor" and "Sort Usings in the Active Project" commands. You can also add "SortUsings" to the "alOutline.codeActionsOnSave" setting. If sorting usings is not enabled for document save event, then you will also be able to see code action when you move the cursor to the usings declarations.

ChrisBlankDe commented 4 months ago

works like charm. THX