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

Add region-restricted parsing and highlighting #202

Open ubolonton opened 2 years ago

ubolonton commented 2 years ago

This will allow jupyter-repl to integrate with tree-sitter and tree-sitter-hl. See #78 for more context.

I initially tried to make tree-sitter parse only the narrowed region. However, since tree-sitter's incremental parsing requires precisely tracking all changes to the source code, there are some issues with that approach:

The design of this new functionality is instead like followed:

Tasks:

orzechowskid commented 2 years ago

looking forward to this PR landing in master. I was just attempting to add tree-sitter support to a CSS-in-JS mode I've been working on, and I think this will be of immense use once it's ready.

thanks!

ubolonton commented 2 years ago

looking forward to this PR landing in master. I was just attempting to add tree-sitter support to a CSS-in-JS mode I've been working on, and I think this will be of immense use once it's ready.

The design in this PR is intended for one-at-a-time parsing of code blocks, so I'm not sure it would help a CSS-in-JS mode (a multi-language use case). How would you use it?