Skip to content

Commit

Permalink
making sure alias's sort properly
Browse files Browse the repository at this point in the history
closes #1168
  • Loading branch information
belav committed Feb 11, 2024
1 parent 84b5bc4 commit e605d54
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Shell/ReviewBranch.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function CSH-ReviewBranch {
if ($firstRun) {
# uses https://github.com/github/hub/releases
# if this hangs run a command against this repo outside of here, it will store
# a token. Or I can just have a way to pass a GITHUB_TOKEN or store it in a .envc
# a token. Or I can just have a way to pass a GITHUB_TOKEN or store it in a .env
$newPr = & hub pull-request -b belav:$preBranch -m "Testing $branch $folder"
Write-Output $newPr
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using A = string;
using B = string;
using C = string;
using D = string;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using A = string;
using B = string;
using C = string;
using D = string;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using D = string;
using C = string;
using B = string;
using A = string;
14 changes: 7 additions & 7 deletions Src/CSharpier/SyntaxPrinter/UsingDirectives.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,28 +268,28 @@ private class DefaultOrder : IComparer<UsingDirectiveSyntax?>
{
public int Compare(UsingDirectiveSyntax? x, UsingDirectiveSyntax? y)
{
if (x?.Name is null)
if (x?.Name is null && y?.Name is not null)
{
return -1;
}

if (y?.Name is null)
if (y?.Name is null && x?.Name is not null)
{
return 1;
}

if (x.Alias is not null && y.Alias is not null)
if (x?.Alias is not null && y?.Alias is not null)
{
return String.Compare(
return string.Compare(
x.Alias.ToFullString(),
y.Alias.ToFullString(),
StringComparison.OrdinalIgnoreCase
);
}

return String.Compare(
x.Name.ToFullString(),
y.Name.ToFullString(),
return string.Compare(
x?.Name?.ToFullString(),
y?.Name?.ToFullString(),
StringComparison.OrdinalIgnoreCase
);
}
Expand Down

0 comments on commit e605d54

Please sign in to comment.