fix: LT05 comment move merges comment with next line's code#2317
Open
garymm wants to merge 1 commit intoquarylabs:mainfrom
Open
fix: LT05 comment move merges comment with next line's code#2317garymm wants to merge 1 commit intoquarylabs:mainfrom
garymm wants to merge 1 commit intoquarylabs:mainfrom
Conversation
fix_long_line_with_comment used create_before with a deep leaf anchor (e.g. FunctionNameIdentifier), inserting the comment inside the wrong tree node. LT01 then removed the newline between the comment and code, producing broken SQL. Use create_after on the indent point's last segment instead, which inserts at the correct tree level. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
benfdking
requested changes
Feb 16, 2026
Collaborator
benfdking
left a comment
There was a problem hiding this comment.
Thanks again for a nice contribution, just a little change to the tests. Also you might want to rebase after some changes to reflow.
Comment on lines
+196
to
+202
| let sql = "\ | ||
| SELECT | ||
| COALESCE( | ||
| REGEXP_EXTRACT(project_id, '^foo-bar-(.+)$'), -- foo-bar-baz -> baz | ||
| REGEXP_EXTRACT(project_id, '^qux-(.+)$') -- qux-corge -> corge | ||
| ) AS result | ||
| FROM t |
Collaborator
There was a problem hiding this comment.
Can we add this test to the LT05 fixtures with a fail and fix string rather than it being here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix_long_line_with_comment used create_before with a deep leaf anchor (e.g. FunctionNameIdentifier), inserting the comment inside the wrong tree node. LT01 then removed the newline between the comment and code, producing broken SQL. Use create_after on the indent point's last segment instead, which inserts at the correct tree level.