Fix incorrect syntax highlighting on lean4-debugging keyword #61
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.
I also encountered #36 and decided to give it a try.
How the bug was introduced
The original code was added in leanprover/lean4@ba4fdce , where you can see
(defconst lean4-debugging '("unreachable" "panic" "assert" "dbgTrace") "lean debugging")
corresponds toThis is where the we should improve into
How to fix it
Now, the other 3 builtin terms didn't change, but
dbgTrace!
was renamed todbg_trace
(https://github.com/leanprover/lean4/blob/6fce8f7d5cd18a4419bca7fd51780c71c9b1cc5a/src/Lean/Parser/Term.lean#L781)That explains line 68-70. But there are 2 more things to explain.
This is because
lean4-constants-regexp
would already fontify!
, so that later lean4-debugging won't fontify those with an!
again.The code is actually working, but overwritten by lsp server. In da21b10, we enabled
lsp-semantic-tokens-enable
, which is an alias oflsp-enable-semantic-highlighting
. It should work correctly when lsp server is not present. (I tested using https://github.com/Lindydancer/font-lock-studio)look and feel:
before the fix:
after the fix: