Skip to content

Commit

Permalink
Update Formatter.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
LPeter1997 committed Oct 23, 2023
1 parent ccfd852 commit c0508c0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Draco.Compiler/Internal/Syntax/Formatting/Formatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ public Formatter(FormatterSettings settings)
this.Settings = settings;
}

public override SyntaxNode VisitCompilationUnit(CompilationUnitSyntax node) => node.Update(this.AppendSequence(
node.Declarations,
Newline,
node.End));

public override SyntaxNode VisitFunctionDeclaration(FunctionDeclarationSyntax node) => node.Update(this.AppendSequence(
node.VisibilityModifier,
Space,
Expand Down Expand Up @@ -165,7 +170,8 @@ private void AddNormalizedTrailingTrivia(SyntaxList<SyntaxTrivia> trivia)
if (t.Kind is not TriviaKind.LineComment or TriviaKind.DocumentationComment) continue;

// Indent the trivia
if (!first) this.EnsureIndentation(this.indentation);
if (first) this.EnsureSpace();
else this.EnsureIndentation(this.indentation);
// Add comment
this.currentTrivia.Add(t);
// Add a newline after
Expand Down

0 comments on commit c0508c0

Please sign in to comment.