Skip to content
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

Sort aliases #1173

Merged
merged 4 commits into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Shell/ReviewBranch.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function CSH-ReviewBranch {
Set-Location $repositoryRoot

if (!$pathToTestingRepo) {
$pathToTestingRepo = "C:\Projects\csharpier-repos"
$pathToTestingRepo = Join-Path $PSScriptRoot "../../csharpier-repos"
}
if ($folder -ne $null) {
$pathToTestingRepo = Join-Path $pathToTestingRepo $folder
Expand Down 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 @@ -277,28 +277,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
Loading