Open ubolonton opened 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!
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?
This will allow
jupyter-repl
to integrate withtree-sitter
andtree-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:before-change-functions
andafter-change-functions
, which can be run while narrowing is enabled for a different region than the intended region.tree-sitter
itself.The design of this new functionality is instead like followed:
tree-sitter
still tracks all changes in the buffer.tree-sitter
parses, it asks the major mode for the region to parse, by calling the functiontree-sitter-get-parse-regions
.tree-sitter-hl
highlights the buffer, it does so only for the parsed region, while using the old region-fontification function for other regions.tree-sitter-hl-dry-up-region
to "persist" the highlighted region (now-frozen input cell).tree-sitter-pause
, and thentree-sitter-resume
afterwards, to start a new, non-incremental parse.Tasks:
jupyter-repl
integrationinferior-python-mode
integration