Skip to content

Commit

Permalink
don't keep this value in two places (#504)
Browse files Browse the repository at this point in the history
  • Loading branch information
belav authored Dec 2, 2021
1 parent 6597401 commit a32bab4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Src/CSharpier/CodeFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ namespace CSharpier;

public class CodeFormatter
{
public static LanguageVersion LanguageVersion = LanguageVersion.CSharp10;

public static string Format(string code, CodeFormatterOptions? options = null)
{
return FormatAsync(code, options).Result;
Expand Down Expand Up @@ -43,8 +45,7 @@ SyntaxTree ParseText(string codeToFormat, params string[] preprocessorSymbols)
return CSharpSyntaxTree.ParseText(
codeToFormat,
new CSharpParseOptions(
// this also exists in SyntaxNodeComparer
LanguageVersion.CSharp10,
LanguageVersion,
DocumentationMode.Diagnose,
preprocessorSymbols: preprocessorSymbols
),
Expand Down
2 changes: 1 addition & 1 deletion Src/CSharpier/SyntaxNodeComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ CancellationToken cancellationToken
this.OriginalSourceCode = originalSourceCode;
this.NewSourceCode = newSourceCode;

var cSharpParseOptions = new CSharpParseOptions(LanguageVersion.CSharp10);
var cSharpParseOptions = new CSharpParseOptions(CodeFormatter.LanguageVersion);
this.OriginalSyntaxTree = CSharpSyntaxTree.ParseText(
this.OriginalSourceCode,
cSharpParseOptions,
Expand Down

0 comments on commit a32bab4

Please sign in to comment.