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

Cross injection layers in tree-sitter motions #5176

Commits on Mar 19, 2024

  1. syntax: Track parent LanguageLayer IDs

    This commit adds a `parent` field to the `LanguageLayer`. This
    information is conveniently already available when we parse injections.
    This will be used in the child commit to create a type that can
    traverse injection layers using this information.
    the-mikedavis committed Mar 19, 2024
    Configuration menu
    Copy the full SHA
    c14af06 View commit details
    Browse the repository at this point in the history
  2. Add a TreeCursor type that travels over injection layers

    This uses the layer parentage information from the parent commit to
    traverse the layers. It's a similar API to `tree_sitter:TreeCursor`
    but internally it does not use a `tree_sitter::TreeCursor` currently
    because that interface is behaving very unexpectedly. Using the
    `next_sibling`/`prev_sibling`/`parent` API on `tree_sitter::Node`
    reflects the previous code's behavior so this should result in no
    surprising changes.
    the-mikedavis committed Mar 19, 2024
    Configuration menu
    Copy the full SHA
    1459f57 View commit details
    Browse the repository at this point in the history
  3. Reimplement tree motions in terms of syntax::TreeCursor

    This uses the new TreeCursor type from the parent commit to reimplement
    the tree-sitter motions (`A-p/o/i/n`). Other tree-sitter related
    features like textobjects are not touched with this change and will
    need a different, unrelated approach to solve.
    the-mikedavis committed Mar 19, 2024
    Configuration menu
    Copy the full SHA
    6f47990 View commit details
    Browse the repository at this point in the history