-
Notifications
You must be signed in to change notification settings - Fork 0
Injected SQL Formatting Enhancement #344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Injected SQL Formatting Enhancement #344
Conversation
… specified indentation level, offset downward by the configured indent amount.
There was a problem hiding this 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 PR enhances SQL formatting within @Sql annotations by improving alignment and indentation logic for embedded SQL strings in Java literal strings, particularly for triple-quoted strings.
Key changes include:
- Refactored SQL indentation to align content with the position after the opening triple quotes
- Simplified post-processing by removing unnecessary parameters and improving text processing
- Enhanced block comment formatting with new specialized block classes
- Consolidated string constants into a centralized utility
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| DaoInjectionSqlVisitor.kt | Core formatting logic updated to improve SQL alignment and simplify indentation handling |
| SqlPostProcessor.kt | Simplified post-processing by removing unused parameters |
| SqlBlockGenerator.kt | Added block comment spacing configuration |
| Multiple comment block files | New classes for handling different parts of block comments (start, content, end) |
| Various utility files | Centralized string constants and updated references to use SINGLE_SPACE |
Updated the formatting logic for SQL embedded within
@Sqlannotations to align with the intended indentation inside Java literal strings, rather than relying on the original line position.Previous PR:
#331
Key Improvements
SQL alignment:
SQL content is now indented to match the position after the opening
"""(triple-quote) of the string literal.Closing quotes alignment:
The closing
"""is automatically placed on a new line, aligned with the first line of the SQL content.Example
Before Formatting:
After Formatting: