Skip to content

Conversation

@xterao
Copy link
Collaborator

@xterao xterao commented Aug 22, 2025

Description:

Fixed the issue where the last column was not moved to a new line when a column appeared after a closed conditional directive.

If a condition start directive (/%if/) includes an /%else/ directive, set the condition end block for the start directive using the /%else/ directive.

@xterao xterao self-assigned this Aug 22, 2025
@github-actions github-actions bot added the fix Bug fixes label Aug 22, 2025
@xterao xterao added this to the 2.1.2 Release milestone Aug 22, 2025
@xterao xterao linked an issue Aug 22, 2025 that may be closed by this pull request
@xterao xterao requested a review from Copilot August 22, 2025 07:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request fixes an issue with SQL formatter handling of conditional directives, specifically ensuring that the last column in conditional blocks properly breaks to a new line when content exceeds available width. The changes improve the formatting logic for conditional comment blocks (/*%if*/, /*%else*/, /*%end*/) in SQL statements.

  • Updated conditional directive handling to use !conditionType.isStartDirective() instead of conditionType.isEnd()
  • Enhanced end block detection logic to properly handle nested conditional structures
  • Added test cases demonstrating proper formatting of conditional SQL blocks

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
SqlElConditionLoopCommentBlock.kt Updated condition checks from isEnd() to !isStartDirective() for better directive handling
SqlBlock.kt Enhanced end block detection logic to handle nested conditional comment blocks
CalculationDirectives.sql Added test case showing unformatted conditional SQL with line break issues
CalculationDirectives_format.sql Added expected formatted output demonstrating proper line breaking in conditional blocks

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@xterao xterao force-pushed the fix/last-column-non-line-break branch from e91eb26 to bf12380 Compare August 22, 2025 07:08
@xterao xterao merged commit 3aa8bb6 into main Aug 22, 2025
5 checks passed
@xterao xterao deleted the fix/last-column-non-line-break branch August 22, 2025 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Last Column Line Is Not Line-Broken

2 participants