Skip to content

refactor: migrate to nvim-treesitter main branch API - #53

Draft
kevintraver wants to merge 1 commit into
RRethy:masterfrom
kevintraver:nvim-treesitter-main-migration
Draft

refactor: migrate to nvim-treesitter main branch API#53
kevintraver wants to merge 1 commit into
RRethy:masterfrom
kevintraver:nvim-treesitter-main-migration

Conversation

@kevintraver

Copy link
Copy Markdown
Contributor
  • Remove dependencies on deprecated nvim-treesitter modules:

    • nvim-treesitter.query
    • nvim-treesitter.parsers
    • nvim-treesitter.ts_utils
  • Replace with native vim.treesitter API:

    • vim.treesitter.query.get() for queries
    • vim.treesitter.get_parser() for parser access
    • Custom update_selection() function
  • Register make-range! as NO-OP directive to prevent errors

  • Implement custom get_capture_matches_recursively() that:

    • Processes make-range! directives manually
    • Creates virtual range objects with start_pos/end_pos
    • Handles both userdata nodes and table-wrapped nodes
    • Maintains compatibility with original TSRange behavior
  • Replace query file checking with vim.api.nvim_get_runtime_file()

  • Simplify injection language detection

This maintains full compatibility with existing query files while working with nvim-treesitter main branch.

- Remove dependencies on deprecated nvim-treesitter modules:
  - nvim-treesitter.query
  - nvim-treesitter.parsers
  - nvim-treesitter.ts_utils

- Replace with native vim.treesitter API:
  - vim.treesitter.query.get() for queries
  - vim.treesitter.get_parser() for parser access
  - Custom update_selection() function

- Register make-range! as NO-OP directive to prevent errors
- Implement custom get_capture_matches_recursively() that:
  - Processes make-range! directives manually
  - Creates virtual range objects with start_pos/end_pos
  - Handles both userdata nodes and table-wrapped nodes
  - Maintains compatibility with original TSRange behavior

- Replace query file checking with vim.api.nvim_get_runtime_file()
- Simplify injection language detection

This maintains full compatibility with existing query files while
working with nvim-treesitter main branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant