Skip to content

fix(lexers): keep GraphQL block string contents together - #1512

Merged
github-actions[bot] merged 1 commit into
alecthomas:masterfrom
yxshee:fix/graphql-block-string-text-nov19
Nov 19, 2026
Merged

github-actions[bot] merged 1 commit into
alecthomas:masterfrom
yxshee:fix/graphql-block-string-text-nov19

Conversation

@yxshee

@yxshee yxshee commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Chroma will highlight Café as a field. Similarly, a block string may terminate prematurely if it contains an escaped triple quote. Either can cause subsequent parts of the schema to be lexed incorrectly.

"""Café "été" here."""
scalar A

As well as allowing any Unicode character, the block string rule will match escaped triple quotes. Both are covered by the added fixture. I have compared the token boundaries of all 14,247 block strings from GitHub's schema with the behavior of the GraphQL.js lexer.

--- FAIL: TestLexers/GraphQL/testdata/graphql.actual

Ran bit -f test, bit -f lint, bit -f check-generated and go test -count=1 ./....

@github-actions
github-actions Bot enabled auto-merge (squash) November 19, 2026 11:16
@github-actions
github-actions Bot merged commit 0897f2f into alecthomas:master Nov 19, 2026
4 checks passed
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.

1 participant