From 6ba63e48441a96dba6074b01c9351566970ca81f Mon Sep 17 00:00:00 2001 From: Garrett Hopper Date: Wed, 7 May 2025 12:07:48 -0500 Subject: [PATCH] Merge metadata from multiple capture nodes --- lua/nvim-treesitter/indent.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/nvim-treesitter/indent.lua b/lua/nvim-treesitter/indent.lua index 19e7ef1ee..deb953116 100644 --- a/lua/nvim-treesitter/indent.lua +++ b/lua/nvim-treesitter/indent.lua @@ -107,8 +107,9 @@ local get_indents = memoize(function(bufnr, root, lang) return map end for id, node, metadata in query:iter_captures(root, bufnr) do - if query.captures[id]:sub(1, 1) ~= "_" then - map[query.captures[id]][node:id()] = metadata or {} + local cap, nid = query.captures[id], node:id() + if cap:sub(1, 1) ~= "_" then + map[cap][nid] = vim.tbl_extend("force", map[cap][nid] or {}, metadata or {}) end end