Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regex in CodeQL TextMate grammar that was silently failing #3903

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

slevithan
Copy link

The TM grammar for CodeQL includes an invalid Oniguruma regex. Specifically, in Oniguruma, lookahead is invalid when used within lookbehind. This leads to the regex failing silently in vscode-textmate, and the regex doesn't match whatever it's intended to match.

Additionally this makes the CodeQL grammar fail entirely when used with Shiki's JS engine (see CodeQL listed as unsupported in Shiki's compatibility list) because Shiki's JS engine doesn't fail silently for invalid Oniguruma regexes.

Because the lookahead appears at the end of the lookbehind, it is easy to just move it outside of the lookbehind, and the regex matches the exact same strings as were intended.

To make this change, I updated extensions/ql-vscode/syntaxes/ql.tmLanguage.yml and then ran the syntaxes/updateSyntax script to generate the JSON version of the grammar.

@slevithan slevithan requested a review from a team as a code owner January 19, 2025 19:45
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