Skip to content

Conversation

@kyleconroy
Copy link
Collaborator

Instead of adding complex comment handling to the AST (Comment struct,
StatementWithComments wrapper), use a simple comment-stripping function
in the test to normalize expected output. This approach:

  • Removes 57 lines from ast/ast.go (Comment, StatementWithComments)
  • Simplifies the parser by just skipping comments instead of tracking them
  • Removes comment formatting code from the format package
  • Adds a simple stripComments() function in tests for expected output normalization

The format tests now compare the formatted output against the original
query with comments stripped, which is simpler and achieves the same goal.

… tests

Instead of adding complex comment handling to the AST (Comment struct,
StatementWithComments wrapper), use a simple comment-stripping function
in the test to normalize expected output. This approach:

- Removes 57 lines from ast/ast.go (Comment, StatementWithComments)
- Simplifies the parser by just skipping comments instead of tracking them
- Removes comment formatting code from the format package
- Adds a simple stripComments() function in tests for expected output normalization

The format tests now compare the formatted output against the original
query with comments stripped, which is simpler and achieves the same goal.
@kyleconroy kyleconroy merged commit 00c905a into main Dec 27, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants