-
Notifications
You must be signed in to change notification settings - Fork 74
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
Syntax highlighting that plays well with font-lock #36
Conversation
9eef772
to
688de32
Compare
"Disable `tree-sitter' in the current buffer." | ||
(remove-hook 'after-change-functions #'tree-sitter--after-change :local) | ||
(remove-hook 'before-change-functions #'tree-sitter--before-change :local) | ||
(setq tree-sitter-tree nil | ||
tree-sitter-parser nil | ||
tree-sitter-language nil)) | ||
|
||
(defmacro tree-sitter--error-protect (body-form &rest error-forms) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you want to use condition-case
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't handle the error. It runs some cleanup code and lets the error propagate.
The closest condition-case
equivalent I can think of doesn't preserve the backtrace:
`(condition-case err
,body-form
(error
,@error-forms
(signal (car err) (cdr err))))
This simplifies the definitions of minor modes that use the syntax tree.
This allows `cargo watch` to run `cask build`
This increases performance a bit
f79ec29
to
5a9a841
Compare
amazing! didn't keep an eye on the project and suddenly, BANG! Syntax highlight is mostly done. |
This is a continuation of #16.
tree-sitter-hl-mode
.tree-sitter-hl-default-patterns
.Add default syntax highlighting patterns to the language bundleThis will be left for later, after improving the binary distribution mechanism.tree-sitter-langs
.@function.method
would map totree-sitter-hl-face:function.method
.tree-sitter-hl-add-patterns
.Map capture names to face names automatically. For exampleThis will be done later, after discussing with upstream tree-sitter about standardization/conventions.@:font-lock-keyword-face
can be mapped to the facefont-lock-keyword-face
.Respect custom keywords added by user throughThis is too difficult currently, even forfont-lock-add-keywords
.font-lock-mode
itself (seefont-lock-refresh-defaults
).org-mode
andmarkdown-mode
.Support embedded blocks of other languages (injections).This will be left for later.For now, trying this requires cloning the language repos into the directory
repos/
next totree-sitter-langs.el
(regardless of installation method).I've been using this, and haven't noticed any performance difference from
font-lock-mode
.In fact, sometimes it feels faster, in large C buffers.