Repository navigation
Check for extra def forms in the built-in font lock patterns - #171
Merged
Merged
Conversation
bbatsov
force-pushed
the
fold-extra-def-forms
branch
from
November 1, 2026 09:11
1bec01d to
927b76f
Compare
At treesit-font-lock-level 4, the rule that highlights the head of every list as a function call came before the definition rules, and the first rule to set a face wins. So the names of methods in defrecord, reify and the like, and of letfn functions, were colored as calls instead of definitions. Move it after them.
The forms in clojure-ts-extra-def-forms got font lock rules of their own, added to a buffer only when it had some, with code to keep the user's disabled features disabled when adding them. Their docstring rule wasn't part of the range settings, so the Markdown in those docstrings wasn't highlighted. Check for them with a predicate in the defn and docstring patterns instead. That costs nothing measurable over the regexps it replaces, and the Markdown range settings come with it.
bbatsov
force-pushed
the
fold-extra-def-forms
branch
from
November 1, 2026 10:38
927b76f to
d33358e
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.
The forms in
clojure-ts-extra-def-formsnow go through the same defn and docstring patterns asdefn, so the Markdown in their docstrings gets highlighted, and the rules added per buffer for them are gone. The function call rule had to move after the definition rules for that, which also fixes method andletfnnames colored as calls at font-lock level 4.