Skip to content

Commit

Permalink
formatting with 0.30.1 (#1386)
Browse files Browse the repository at this point in the history
  • Loading branch information
belav authored Nov 18, 2024
1 parent fedc791 commit 4dd71fa
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.29.2",
"version": "0.30.1",
"commands": [
"dotnet-csharpier"
]
Expand Down
19 changes: 9 additions & 10 deletions Src/CSharpier.Cli/EditorConfig/ConfigFileParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ internal static class ConfigFileParser
// "Comment: starts with a ; or a #."
private static readonly Regex CommentRegex = new("^[;#].*$");

private static readonly IniParserConfiguration Configuration =
new()
{
CommentRegex = CommentRegex,
AllowDuplicateKeys = true,
AllowDuplicateSections = true,
OverrideDuplicateKeys = true,
SkipInvalidLines = true,
ThrowExceptionsOnError = false,
};
private static readonly IniParserConfiguration Configuration = new()
{
CommentRegex = CommentRegex,
AllowDuplicateKeys = true,
AllowDuplicateSections = true,
OverrideDuplicateKeys = true,
SkipInvalidLines = true,
ThrowExceptionsOnError = false,
};

public static ConfigFile Parse(string filePath, IFileSystem fileSystem)
{
Expand Down
15 changes: 7 additions & 8 deletions Src/CSharpier.Cli/EditorConfig/Globber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ namespace CSharpier.Cli.EditorConfig;

internal static class Globber
{
private static readonly GlobMatcherOptions globOptions =
new()
{
MatchBase = true,
Dot = true,
AllowWindowsPaths = true,
AllowSingleBraceSets = true,
};
private static readonly GlobMatcherOptions globOptions = new()
{
MatchBase = true,
Dot = true,
AllowWindowsPaths = true,
AllowSingleBraceSets = true,
};

public static GlobMatcher Create(string files, string directory)
{
Expand Down
36 changes: 17 additions & 19 deletions Src/CSharpier.FakeGenerators/Ignored.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,22 @@ public static class Ignored

public static readonly Type[] Types = { typeof(TextSpan), typeof(SyntaxTree) };

public static readonly Dictionary<Type, string[]> PropertiesByType =
new()
{
{ typeof(PropertyDeclarationSyntax), new[] { "semicolon" } },
{ typeof(IndexerDeclarationSyntax), new[] { "semicolon" } },
{ typeof(SyntaxTrivia), new[] { "token" } },
{ typeof(SyntaxToken), new[] { "value", "valueText" } },
{ typeof(ParameterSyntax), new[] { "exclamationExclamationToken" } },
};
public static readonly Dictionary<Type, string[]> PropertiesByType = new()
{
{ typeof(PropertyDeclarationSyntax), new[] { "semicolon" } },
{ typeof(IndexerDeclarationSyntax), new[] { "semicolon" } },
{ typeof(SyntaxTrivia), new[] { "token" } },
{ typeof(SyntaxToken), new[] { "value", "valueText" } },
{ typeof(ParameterSyntax), new[] { "exclamationExclamationToken" } },
};

public static readonly HashSet<string> UnsupportedNodes =
new()
{
// if new versions of c# add node types, we need to ignore them in the generators
// until codeAnalysis + sdks are updated
// global.json doesn't seem to always be respected for builds (namely VS but rider started having the same problem)
// which causes the generators to generate code for the new node types
// but then the build fails because those types don't exist in the packages the actual project references
// "ListPatternSyntax", "SlicePatternSyntax"
};
public static readonly HashSet<string> UnsupportedNodes = new()
{
// if new versions of c# add node types, we need to ignore them in the generators
// until codeAnalysis + sdks are updated
// global.json doesn't seem to always be respected for builds (namely VS but rider started having the same problem)
// which causes the generators to generate code for the new node types
// but then the build fails because those types don't exist in the packages the actual project references
// "ListPatternSyntax", "SlicePatternSyntax"
};
}
89 changes: 44 additions & 45 deletions Src/CSharpier.Tests/MissingTypeChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,49 +70,48 @@ public void Ensure_There_Are_No_Missing_Types()
missingTypes.Should().BeEmpty();
}

private readonly HashSet<string> ignored =
new()
{
"AccessorDeclarationSyntax",
"AccessorListSyntax",
"AttributeArgumentListSyntax",
"AttributeArgumentSyntax",
"AttributeSyntax",
"AttributeTargetSpecifierSyntax",
"BaseListSyntax",
"CatchDeclarationSyntax",
"CatchFilterClauseSyntax",
"ConstructorInitializerSyntax",
"ConversionOperatorMemberCrefSyntax",
"CrefBracketedParameterListSyntax",
"CrefParameterListSyntax",
"CrefParameterSyntax",
"ExplicitInterfaceSpecifierSyntax",
"FunctionPointerCallingConventionSyntax",
"FunctionPointerParameterListSyntax",
"FunctionPointerParameterSyntax",
"FunctionPointerUnmanagedCallingConventionListSyntax",
"FunctionPointerUnmanagedCallingConventionSyntax",
"IndexerMemberCrefSyntax",
"InterpolationAlignmentClauseSyntax",
"InterpolationFormatClauseSyntax",
"JoinIntoClauseSyntax",
"LineDirectivePositionSyntax",
"NameMemberCrefSyntax",
"OperatorMemberCrefSyntax",
"OrderingSyntax",
"PositionalPatternClauseSyntax",
"PropertyPatternClauseSyntax",
"QualifiedCrefSyntax",
"SubpatternSyntax",
"SwitchExpressionArmSyntax",
"TypeCrefSyntax",
"XmlCrefAttributeSyntax",
"XmlElementEndTagSyntax",
"XmlElementStartTagSyntax",
"XmlNameAttributeSyntax",
"XmlNameSyntax",
"XmlPrefixSyntax",
"XmlTextAttributeSyntax",
};
private readonly HashSet<string> ignored = new()
{
"AccessorDeclarationSyntax",
"AccessorListSyntax",
"AttributeArgumentListSyntax",
"AttributeArgumentSyntax",
"AttributeSyntax",
"AttributeTargetSpecifierSyntax",
"BaseListSyntax",
"CatchDeclarationSyntax",
"CatchFilterClauseSyntax",
"ConstructorInitializerSyntax",
"ConversionOperatorMemberCrefSyntax",
"CrefBracketedParameterListSyntax",
"CrefParameterListSyntax",
"CrefParameterSyntax",
"ExplicitInterfaceSpecifierSyntax",
"FunctionPointerCallingConventionSyntax",
"FunctionPointerParameterListSyntax",
"FunctionPointerParameterSyntax",
"FunctionPointerUnmanagedCallingConventionListSyntax",
"FunctionPointerUnmanagedCallingConventionSyntax",
"IndexerMemberCrefSyntax",
"InterpolationAlignmentClauseSyntax",
"InterpolationFormatClauseSyntax",
"JoinIntoClauseSyntax",
"LineDirectivePositionSyntax",
"NameMemberCrefSyntax",
"OperatorMemberCrefSyntax",
"OrderingSyntax",
"PositionalPatternClauseSyntax",
"PropertyPatternClauseSyntax",
"QualifiedCrefSyntax",
"SubpatternSyntax",
"SwitchExpressionArmSyntax",
"TypeCrefSyntax",
"XmlCrefAttributeSyntax",
"XmlElementEndTagSyntax",
"XmlElementStartTagSyntax",
"XmlNameAttributeSyntax",
"XmlNameSyntax",
"XmlPrefixSyntax",
"XmlTextAttributeSyntax",
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ protected void LoadFrom(CSharpierOptions newInstance)
this.DisableCSharpierServer = newInstance.DisableCSharpierServer;
}

private static readonly AsyncLazy<CSharpierOptions> liveModel =
new(CreateAsync, ThreadHelper.JoinableTaskFactory);
private static readonly AsyncLazy<CSharpierOptions> liveModel = new(
CreateAsync,
ThreadHelper.JoinableTaskFactory
);

private static FileSystemWatcher _hotReloadWatcher;

Expand Down
6 changes: 4 additions & 2 deletions Src/CSharpier/DocTypes/Doc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ public static implicit operator Doc(string value)

public static readonly HardLine HardLineIfNoPreviousLine = new(true);

public static readonly HardLine HardLineIfNoPreviousLineSkipBreakIfFirstInGroup =
new(true, true);
public static readonly HardLine HardLineIfNoPreviousLineSkipBreakIfFirstInGroup = new(
true,
true
);

public static readonly LiteralLine LiteralLine = new();

Expand Down
6 changes: 4 additions & 2 deletions Src/CSharpier/Formatters/CSharp/PreprocessorSymbols.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ internal class PreprocessorSymbols : CSharpSyntaxWalker
{
private readonly List<string[]> symbolSets = new();
private readonly HashSet<string> squashedSymbolSets = new();
private SymbolContext CurrentContext =
new() { ParentContext = new SymbolContext { ParentContext = null! } };
private SymbolContext CurrentContext = new()
{
ParentContext = new SymbolContext { ParentContext = null! },
};

private PreprocessorSymbols()
: base(SyntaxWalkerDepth.Trivia) { }
Expand Down

0 comments on commit 4dd71fa

Please sign in to comment.