-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only sort modifiers that we know should be sorted. (#1124)
* Only sort modifiers that we know should be sorted. closes #1123 * formatting files
- Loading branch information
Showing
12 changed files
with
51 additions
and
16 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/Modifiers_NotSorted.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 @@ | ||
class ClassName | ||
{ | ||
// we could add ref to the sorting logic to ensure this stays in the correct order of `ref readonly` | ||
// but being explicit about only sorting Modifiers on specific SyntaxNodes seems safer long term | ||
void Method(ref readonly int someParameter) { } | ||
} |
12 changes: 11 additions & 1 deletion
12
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/Modifiers_Sort.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 |
---|---|---|
@@ -1,6 +1,16 @@ | ||
public class ClassName | ||
CallMethod(static async () => { }); | ||
|
||
CallMethod(static async o => { }); | ||
|
||
public static class ClassName | ||
{ | ||
public static int Field; | ||
|
||
public static int Property { public private get; set; } | ||
|
||
public static async MethodName() { } | ||
} | ||
|
||
public partial class PartialClass { } | ||
|
||
protected internal delegate void D(); |
14 changes: 12 additions & 2 deletions
14
Src/CSharpier.Tests/FormattingTests/TestFiles/cs/Modifiers_Sort.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,6 +1,16 @@ | ||
public class ClassName | ||
CallMethod(async static () => { }); | ||
|
||
CallMethod(async static o => { }); | ||
|
||
static public class ClassName | ||
{ | ||
static public int Field; | ||
|
||
static public int Property { private public get; set; } | ||
|
||
async static public MethodName() { } | ||
} | ||
|
||
public partial class PartialClass { } | ||
partial public class PartialClass { } | ||
|
||
internal protected delegate void D (); |
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
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
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