Skip to content

fix: handle iter_matches node arrays from Neovim 0.12+#528

Open
IjonTichyRaumpilot wants to merge 1 commit into
stevearc:masterfrom
IjonTichyRaumpilot:fix/nvim-012-iter-matches-node-array
Open

fix: handle iter_matches node arrays from Neovim 0.12+#528
IjonTichyRaumpilot wants to merge 1 commit into
stevearc:masterfrom
IjonTichyRaumpilot:fix/nvim-012-iter-matches-node-array

Conversation

@IjonTichyRaumpilot

Copy link
Copy Markdown

Summary

Neovim 0.12 changed the behavior of iter_matches: each capture now returns a list of nodes instead of a single node. This breaks the treesitter backend in aerial with errors like:

attempt to call method 'start' (a nil value)
  ...aerial.nvim/lua/aerial/backends/treesitter/helpers.lua:13
attempt to call method 'type' (a nil value)
  ...aerial.nvim/lua/aerial/backends/treesitter/extensions.lua:118

Fix

Normalize the node value in the iter_matches loop in init.lua by unwrapping the table when one is returned:

if type(node) == "table" then
  node = node[#node]
end

This matches the previous single-node behavior. The existing all = false workaround in the iter_matches call (from #407) is no longer sufficient with Neovim 0.12.

Test

Verified on Neovim v0.12.3 — opening any file no longer produces treesitter backend errors.

🤖 Generated with Claude Code

Neovim 0.12 changed iter_matches so that each capture returns a list
of nodes instead of a single node, breaking the treesitter backend with
"attempt to call method 'start' (a nil value)" errors.

Normalize the node value by taking the last element when a table is
returned, which matches the behavior of the previous single-node return.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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