-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Sorting usings #923
Merged
Merged
Sorting usings #923
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
de96c75
Initial work for sorting usings
belav 3383f7a
handling more cases
belav 0e9b796
maybe fixing last edge case
belav bbd53b0
Sort by alias
belav 2f63d8b
Merge branch 'main' into sort-usings
belav 5f013d8
Merge branch 'main' into sort-usings
belav f21bbad
Fixing some edge cases. Cleaning up sorting.
belav d7241bf
Working on validation, notes for some failing to compile files
belav 29527c1
Making progress on edge cases for sorting usings
belav 54d9889
Adding even more edge cases
belav 9208e24
Merge branch 'main' into sort-usings
belav fc75190
Some finishing touches
belav ecea472
Merge remote-tracking branch 'origin/sort-usings' into sort-usings
belav 45b9d68
Self code review
belav 17eb944
Merge branch 'main' into sort-usings
belav c7d7165
minor change
belav 6802f6f
Merge branch 'main' into sort-usings
belav File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
function CSH-Release { | ||
function CSH-CreateRelease { | ||
param ( | ||
[Parameter(Mandatory=$true)] | ||
[string]$versionNumber | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function CSH-DeleteReviewBranches { | ||
|
||
# TODO probably make this configurable | ||
$pathToTestingRepo = "C:/Projects/csharpier-repos" | ||
Set-Location $pathToTestingRepo | ||
|
||
git checkout main | ||
git branch | Where-Object { $_ -notmatch "main" } | ForEach-Object { git branch -D $_ } | ||
git branch -r | Where-Object { $_ -notmatch "origin/main" } | ForEach-Object { git push origin --delete $_.Replace("origin/", "").Trim() } | ||
} | ||
|
||
Export-ModuleMember -Function CSH-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/Directives_CompilationUnit.test
This file was deleted.
Oops, something went wrong.
22 changes: 3 additions & 19 deletions
22
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,13 @@ | ||
// leading | ||
using First; // trailing | ||
|
||
using A; // trailing | ||
// leading with space | ||
using // another trailing | ||
Second; | ||
|
||
using | ||
// static leading | ||
static // static trailing | ||
Third; | ||
|
||
using M = System.Math; | ||
using Point = (int x, int y); | ||
|
||
using static System.Math; | ||
|
||
global using System; | ||
|
||
using First; | ||
using Second; | ||
B; | ||
|
||
namespace Namespace | ||
{ | ||
using Third; | ||
using One.Two.Three; | ||
using Third; | ||
|
||
public class ClassName { } | ||
} |
4 changes: 4 additions & 0 deletions
4
...harpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_BasicIfDirective.expected.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
using System; | ||
#if DEBUG | ||
using Insite.Bad; | ||
#endif |
4 changes: 4 additions & 0 deletions
4
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_BasicIfDirective.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#if DEBUG | ||
using Insite.Bad; | ||
#endif | ||
using System; |
5 changes: 5 additions & 0 deletions
5
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_BasicSort.expected.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
using AWord; | ||
using BWord; | ||
using MWord; | ||
using YWord; | ||
using ZWord; |
5 changes: 5 additions & 0 deletions
5
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_BasicSort.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
using MWord; | ||
using ZWord; | ||
using AWord; | ||
using BWord; | ||
using YWord; |
7 changes: 7 additions & 0 deletions
7
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_Basics.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
global using Global; | ||
using System; | ||
using global::Zebra; | ||
using Custom; | ||
using static Expression; | ||
using Point = (int x, int y); | ||
using Index = Microsoft.Framework.Index; |
9 changes: 9 additions & 0 deletions
9
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_EdgeCase1.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#if BUILD_MSI_TASKS | ||
using System; | ||
using Microsoft.Build.Framework; | ||
|
||
namespace RepoTasks; | ||
|
||
class ClassName { } | ||
|
||
#endif |
6 changes: 6 additions & 0 deletions
6
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_EdgeCase2.expected.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
using System.IO; | ||
#if DEBUG | ||
using System; | ||
#else | ||
using Microsoft; | ||
#endif |
6 changes: 6 additions & 0 deletions
6
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_EdgeCase2.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#if DEBUG | ||
using System; | ||
#else | ||
using Microsoft; | ||
#endif | ||
using System.IO; |
6 changes: 6 additions & 0 deletions
6
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_EdgeCase3.expected.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
using System.IO; | ||
#if !DEBUG | ||
using System; | ||
#else | ||
using Microsoft; | ||
#endif |
6 changes: 6 additions & 0 deletions
6
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_EdgeCase3.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#if !DEBUG | ||
using System; | ||
#else | ||
using Microsoft; | ||
#endif | ||
using System.IO; |
8 changes: 8 additions & 0 deletions
8
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_EdgeCase4.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#if DEBUG | ||
using A; | ||
#else | ||
using B; | ||
#endif | ||
#if !DEBUG | ||
using C; | ||
#endif |
10 changes: 10 additions & 0 deletions
10
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_EdgeCase5.expected.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using C; | ||
#if DEBUG | ||
using A; | ||
#else | ||
using B; | ||
#endif | ||
|
||
#if !DEBUG | ||
using C; | ||
#endif |
9 changes: 9 additions & 0 deletions
9
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_EdgeCase5.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#if DEBUG | ||
using A; | ||
#else | ||
using B; | ||
#endif | ||
using C; | ||
#if !DEBUG | ||
using C; | ||
#endif |
6 changes: 6 additions & 0 deletions
6
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_EdgeCase6.expected.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#if DEBUG | ||
#define SYMBOL | ||
#endif | ||
|
||
using System; | ||
using System.Collections; |
6 changes: 6 additions & 0 deletions
6
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_EdgeCase6.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#if DEBUG | ||
#define SYMBOL | ||
#endif | ||
|
||
using System.Collections; | ||
using System; |
7 changes: 7 additions & 0 deletions
7
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_EdgeCase7.expected.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#if DEBUG | ||
extern alias MonoSecurity; | ||
#else | ||
using Mono.Security.Cryptography; | ||
#endif | ||
|
||
using System; |
7 changes: 7 additions & 0 deletions
7
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_EdgeCase7.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#if DEBUG | ||
extern alias MonoSecurity; | ||
#else | ||
using Mono.Security.Cryptography; | ||
#endif | ||
|
||
using System; |
6 changes: 6 additions & 0 deletions
6
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_EdgeCase9.expected.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#if XMLCHARTYPE_GEN_RESOURCE | ||
#undef XMLCHARTYPE_USE_RESOURCE | ||
#endif | ||
|
||
using System.Diagnostics; | ||
using System.Threading; |
6 changes: 6 additions & 0 deletions
6
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_EdgeCase9.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#if XMLCHARTYPE_GEN_RESOURCE | ||
#undef XMLCHARTYPE_USE_RESOURCE | ||
#endif | ||
|
||
using System.Threading; | ||
using System.Diagnostics; |
4 changes: 4 additions & 0 deletions
4
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_FileComments.expected.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Licensed to something | ||
|
||
using Apple; | ||
using Microsoft; |
4 changes: 4 additions & 0 deletions
4
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_FileComments.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Licensed to something | ||
|
||
using Microsoft; | ||
using Apple; |
7 changes: 7 additions & 0 deletions
7
...Sharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_KeepDefineAtTop.expected.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// | ||
|
||
#define USE_STRUCT | ||
using System; | ||
using System.Runtime.CompilerServices; |
7 changes: 7 additions & 0 deletions
7
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_KeepDefineAtTop.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// | ||
|
||
#define USE_STRUCT | ||
using System.Runtime.CompilerServices; | ||
using System; |
7 changes: 7 additions & 0 deletions
7
...CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_KeepUndefAtTop.expected.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// | ||
|
||
#undef USE_STRUCT | ||
using System; | ||
using System.Runtime.CompilerServices; |
8 changes: 8 additions & 0 deletions
8
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_KeepUndefAtTop.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// | ||
|
||
#undef USE_STRUCT | ||
using System.Runtime.CompilerServices; | ||
using System; | ||
|
3 changes: 3 additions & 0 deletions
3
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_SortsAlias.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
using A = Z; | ||
using M = A; | ||
using Z = M; |
4 changes: 4 additions & 0 deletions
4
...harpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_SortsSystemToTop.expected.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
using System; | ||
using System.Web; | ||
using AWord; | ||
using ZWord; |
4 changes: 4 additions & 0 deletions
4
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/UsingDirectives_SortsSystemToTop.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
using ZWord; | ||
using AWord; | ||
using System.Web; | ||
using System; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
wtf is this?
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.
I believe that was me going nuts trying comments everywhere a while back.
Apparently that is valid c#!