Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect injections in tree-sitter features #9425

Open
6 of 11 tasks
the-mikedavis opened this issue Jan 25, 2024 · 0 comments
Open
6 of 11 tasks

Respect injections in tree-sitter features #9425

the-mikedavis opened this issue Jan 25, 2024 · 0 comments
Assignees
Labels
A-tree-sitter Area: Tree-sitter C-enhancement Category: Improvements

Comments

@the-mikedavis
Copy link
Member

the-mikedavis commented Jan 25, 2024

This is meant to be a tracking issue for taking injections into account for all tree-sitter features. There are three separate APIs we need to use injections robustly:

  1. Run queries across injection layers. Highlights do this correctly but indent and textobject queries currently run only against the root layer. Run textobject queries across injections #9320 will add the necessary API here which indents can build off of.
  2. Operate on the proper tree_sitter::Tree of the layer the input positions/bytes are within. Callers currently use Syntax::tree, so they only operate on the root. This is a little broad but Select subtree within injections in :tree-sitter-subtree #9309 initially added the function to make this possible, Respect injections when using the syntax tree's root node #9424 and Cross injection layers in tree-sitter motions #5176 improve the situation, and ultimately this will be fixed once we update the indentation system to respect injection layers. Then Syntax::tree should be removed.
  3. Use the language configuration for the layer the input positions/bytes are within. This applies to things like auto-pairs and comment tokens, for example Determine comment tokens from injection layers #7364. We don't have an API for this yet but see Determine comment tokens from injection layers #7364 (comment) for an outline on how it should work.

Feature-wise:

The changes build on one another somewhat, so we will need to wait until the changes for the first API and the third API are merged in order to fix indentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tree-sitter Area: Tree-sitter C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

1 participant