fix(editor): keep reading the keyword behind an invisible character - #3025
Merged
Merged
Conversation
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.
#3005 moved the classifier onto the shared lexer's code projection, and the new leading-keyword scan skipped only
Character.isWhitespace. The old one skipped everythingStatementBlankcalls blank, which is what #2729 added so a zero-width space or a byte-order mark in front of a statement could not hide its keyword. So\u{FEFF}SELECT 1stopped reading as a SELECT and fell to the write arm, andQueryClassifierInvisibleCharacterTestsandQueryDiagnosticsRefreshTestshave failed onmainsince.The scan drops
StatementBlank.isBlankagain, so a leading invisible character is passed over and a visible combining mark still ends it (markedBlankIsNotSkipped).The other change is a test #3005 wrote that contradicts the engine. It expected
SELECT<NBSP>$$a b$$to hold a dollar-quoted literal. Measured on PostgreSQL 17, that text is a syntax error: every byte over 0x7F continues an identifier there, so a$glued to one opens no literal, which is what the lexer already says. The test now asserts the measured behaviour, and a second case covers a dollar-quoted body after an ordinary space, which is kept.QueryClassifierInvisibleCharacterTests,InvisibleCharacterRemoverTests,QueryClassifierTests,QueryClassifierLexicalTests,QueryClassifierPLSQLTests,QueryDiagnosticsRefreshTests,SQLConfusableCharacterScannerTests,ExternalStatementGateLexicalTests,MCPStatementGateTests,SQLStatementScannerTestsandCatalogChangeClassifierTests: 256 cases, all passing.