Skip to content

Conversation

@xitep
Copy link
Contributor

@xitep xitep commented Nov 8, 2025

  • Includes the "update" keyword itself in the corresponding statement, making the statement's span cover its parsed source code

  • Motivation: party a (SQL) re-formatter and party the need to extract possible comments preceding the statements (and/or right after the keyword)

  • Related: [EPIC] Complete Span (source location) information / feature #1548

@xitep xitep force-pushed the main branch 4 times, most recently from 42aba2d to bfc8770 Compare November 8, 2025 11:30
Comment on lines +5143 to +5146
insert_token: AttachedToken(TokenWithSpan {
token: Token::make_keyword("INSERT"),
span: Span::new((1, 1).into(), (1, 7).into()),
}),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
insert_token: AttachedToken(TokenWithSpan {
token: Token::make_keyword("INSERT"),
span: Span::new((1, 1).into(), (1, 7).into()),
}),
insert_token: AttachedToken::empty(),

I think for these we can use an empty token - since token comparisons are ignored in tests. Same for the other files

}

#[test]
fn test_update_statement_span() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add similar test for DELETE, INSERT, REPLACE statements?

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