Skip to content

fix: LT05 comment move merges comment with next line's code#2317

Open
garymm wants to merge 1 commit intoquarylabs:mainfrom
garymm:garymm/long-line-bug
Open

fix: LT05 comment move merges comment with next line's code#2317
garymm wants to merge 1 commit intoquarylabs:mainfrom
garymm:garymm/long-line-bug

Conversation

@garymm
Copy link
Contributor

@garymm garymm commented Feb 13, 2026

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.

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>
Copy link
Collaborator

@benfdking benfdking left a comment

Choose a reason for hiding this comment

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

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add this test to the LT05 fixtures with a fail and fix string rather than it being here?

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.

2 participants