Fix highlighting for set-prefixed identifiers#1913
Open
puneetdixit200 wants to merge 3 commits into
Open
Conversation
rolandwalker
reviewed
Jun 4, 2026
| tokens = { | ||
| "root": [(r"\brepair\b", Keyword), (r"\boffset\b", Keyword), inherit], | ||
| "root": [ | ||
| (r"\bset[\w$]+\b", Name), |
Contributor
There was a problem hiding this comment.
Since this was fixed upstream, can we add a TODO comment on the set line explaining that it won't be needed after Pygments is upgraded above v2.20.0 ?
rolandwalker
reviewed
Jun 4, 2026
| * Add CI on macOS. | ||
| * Add limited CI on Windows. | ||
| * Add limited CI on Windows WSL. | ||
| * Keep identifiers that start with `set` highlighted as names. |
Contributor
There was a problem hiding this comment.
This seems like it should be in a Bug Fixes section rather than Internal, since it is visible to the user.
d8a1aff to
840a36a
Compare
Contributor
|
Thanks for the updates! There seem to be some unrelated changes added. |
190b9ac to
c9cb6f8
Compare
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.
Description
Fixes #1872.
MyCliLexernow recognizes identifiers that start withsetbefore falling through to Pygments' MySQL lexer, so table names such assettings_123stay highlighted as a single name instead of splittingsetas a keyword. The standaloneSETkeyword still falls through to the inherited lexer.I added a regression test, updated the changelog, and added my name to the authors list.
Tests run:
PYTHONPATH=. UV_CACHE_DIR=/tmp/mycli-1872-uv-cache uv run --extra dev pytest test/pytests/test_lexer.py -q(failed before the lexer fix, passed after)PYTHONPATH=. UV_CACHE_DIR=/tmp/mycli-1872-uv-cache uv run --extra dev pytest test/pytests/test_lexer.py test/pytests/test_naive_completion.py test/pytests/test_clistyle.py -qPYTHONPATH=. UV_CACHE_DIR=/tmp/mycli-1872-uv-cache uv run --extra dev ruff checkPYTHONPATH=. UV_CACHE_DIR=/tmp/mycli-1872-uv-cache uv run --extra dev ruff format --checkPYTHONPATH=. UV_CACHE_DIR=/tmp/mycli-1872-uv-cache uv run --extra dev mypy mycli/lexer.py test/pytests/test_lexer.pygit diff --checkI used AI assistance while preparing this change and reviewed/tested the result locally.
Checklist
changelog.mdfile.AUTHORSfile (or it's already there).uv run ruff check && uv run ruff format