fix: remove stray f-string sub-rule that mis-highlights PRQL f-strings - #6095
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.
Nightly survey finding in the PRQL syntax-highlighting definition.
Stray f-string sub-rule (the fix). The f-string mode's
containsheld a sub-rule{ scope: "variable", begin: "f", end: '"' }. The parent mode'sbeginisf", so the openingfprefix is already consumed before any child rule runs — this sub-rule could therefore only match a strayfinside the string body, starting avariablespan that runs to the closing quote and mis-coloring the surrounding text. The parallel s-string block has no such rule. It was a leftover experiment (note the commented-outexcludesEnd).Verified empirically with highlight.js 11.11.1 on
f"info {x}":Applied to both the book copy (
web/book/highlight-prql.js) and the website copy (web/website/themes/prql-theme/static/plugins/highlight/prql.js), which the header comments ask to be kept consistent.Stale comment (book copy only). Also removed a comment claiming mdBook exposes a minified highlight.js requiring abbreviated property names (
b => begin,e => end, …). The definition objects below it use the full names (begin,end,contains,scope,match,keywords), so the comment is stale and would mislead an editor.No repo test harness exists for the highlight definition, so there's no unit test to add; the behavior change is verified via the highlight.js run above.