emacs-tree-sitter / elisp-tree-sitter

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

solution for multi-language files #33

Open shackra opened 4 years ago

shackra commented 4 years ago

@yyoncho noted that in Emacs sometimes a mapping of major mode and language is not as straightforward as N -> 1, but rather N -> N, that is to say that some major modes have to handle different languages at once, like web-mode which handles HTML, CSS, TypeScript, JavaScript and so on.

Thus, is required that emacs-tree-sitter handles this kind of edge cases gracefully.

Abdillah commented 3 years ago

This might be relevant: https://tree-sitter.github.io/tree-sitter/using-parsers#multi-language-documents

laduke commented 1 year ago

Anyone know how to do this?

"Just" need to tell tree-sitter to switch from js to html inside of

html``

html`<h1>hello</h1>`

Heres a vscode thing that does it. https://marketplace.visualstudio.com/items?itemName=runem.lit-plugin