Skip to content

feat(ALL): check children treesitter languages after parents#2407

Draft
TheLeoP wants to merge 1 commit intonvim-mini:mainfrom
TheLeoP:poc
Draft

feat(ALL): check children treesitter languages after parents#2407
TheLeoP wants to merge 1 commit intonvim-mini:mainfrom
TheLeoP:poc

Conversation

@TheLeoP
Copy link
Copy Markdown
Member

@TheLeoP TheLeoP commented May 6, 2026

This PR is only a proof of concept of what a fix for #2397 would look like.

Thoughts:

  • The easiest way to test this could be to create queries for injecting Lua into some Lua strings
  • mini.surround doesn't seem to need this change since the cursor always needs to already be on top of the region with a treesitter injection. So, it will be parsed even before this PR when going up the tree.

@TheLeoP TheLeoP marked this pull request as draft May 6, 2026 03:21
@echasnovski
Copy link
Copy Markdown
Member

Thanks for the PR!

  • The easiest way to test this could be to create queries for injecting Lua into some Lua strings

There are already tests for injected languages (this one for 'mini.ai'). They use built-in Lua -> Vimscript injections.

I think tests for this could use even Lua -> Vimscript -> Lua injections. Like here:

vim.cmd([[
  set cursorline
  lua local a = 1
]])
  • mini.surround doesn't seem to need this change since the cursor always needs to already be on top of the region with a treesitter injection. So, it will be parsed even before this PR when going up the tree.

There is less overall complexity if tree-sitter related (and even some other) code in 'mini.ai' and 'mini.surround' is kept as aligned as possible.


As per this PR, please reduce code duplication. Both parents and children are meant to be processed exactly the same, right? In both 'mini.ai' and 'mini.surround' this processing is rather complicated, so even with two times duplication it adds a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants