Last active
October 14, 2021 00:01
-
-
Save ananthakumaran/ed91ef5a7bbf679cdf13e8a65ea54abe to your computer and use it in GitHub Desktop.
This file contains 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
(defface tree-sitter-hl-face:warning | |
'((default :inherit font-lock-warning-face)) | |
"Face for parser errors" | |
:group 'tree-sitter-hl-faces) | |
(defun hook/tree-sitter-common () | |
(unless font-lock-defaults | |
(setq font-lock-defaults '(nil))) | |
(setq tree-sitter-hl-use-font-lock-keywords nil) | |
(tree-sitter-mode +1) | |
(tree-sitter-hl-mode +1)) | |
(defun hook/elixir-tree-sitter () | |
(setq | |
tree-sitter-hl-default-patterns | |
(read | |
(concat | |
"[" | |
(s-replace "#match?" ".match?" | |
(f-read-text (expand-file-name "~/work/repos/tree-sitter-elixir/queries/highlights.scm"))) | |
"]"))) | |
(hook/tree-sitter-common)) | |
(use-package tree-sitter | |
:ensure t | |
:hook ((elixir-mode . hook/elixir-tree-sitter)) | |
:custom-face | |
(tree-sitter-hl-face:operator ((t))) | |
(tree-sitter-hl-face:variable ((t))) | |
(tree-sitter-hl-face:function.method.call ((t))) | |
(tree-sitter-hl-face:property ((t))) | |
:config | |
(setq tree-sitter-debug-highlight-jump-region t) | |
(setq tree-sitter-debug-jump-buttons t)) | |
(use-package tree-sitter-langs | |
:ensure t | |
:after tree-sitter | |
:config | |
(add-to-list 'tree-sitter-major-mode-language-alist '(elixir-mode . elixir))) | |
(provide 'init-tree-sitter) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@jsmestad
Here is my tree-sitter config with doom emacs:
From my quick testing, everything works well