emacs-tree-sitter / elisp-tree-sitter

Emacs Lisp bindings for tree-sitter
https://emacs-tree-sitter.github.io
MIT License
816 stars 73 forks source link

(How) Can emacs-tree-sitter recognize additional languages/modes? #142

Closed ianyepan closed 3 years ago

ianyepan commented 3 years ago

As titled, how can we add new languages/Emacs modes to tree-sitter? For instance, Emacs Lisp, or mhtml-mode, which is the default major mode for HTML files.

theHamsta commented 3 years ago

New languages can be added in the tree-sitter-langs. There you can find also an explanation on how to add languages: https://github.com/ubolonton/tree-sitter-langs (there is even a PR for mhtml.

Regarding Emacs Lisp, I've created a Common Lisp grammar https://github.com/theHamsta/tree-sitter-commonlisp based on https://github.com/sogaiu/tree-sitter-clojure. You might be able to either adapt the Common Lisp grammar or use sogaiu's clojure or Janet grammar as a starting point to create a parser that could be added to tree-sitter-langs.

shackra commented 3 years ago

It seems like the question was answered