From 51da6d66d50d4f7986142f5c76ccc51e5da2a5d6 Mon Sep 17 00:00:00 2001 From: Fionn Fitzmaurice Date: Fri, 3 Jul 2026 19:47:32 +0800 Subject: [PATCH] Permit swap_previous, swap_next to take a list of query strings The swap_next function takes a query_strings argument. Despite this being plural, the type annotation claims that this should be a string. However, we pass this argument to swap_textobject which expects type string | string[]. This also makes the swap functions better correspond to those of move, e.g. goto_next_start also accepts query_strings of type string[]. The same holds also for swap_previous. --- lua/nvim-treesitter-textobjects/swap.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/nvim-treesitter-textobjects/swap.lua b/lua/nvim-treesitter-textobjects/swap.lua index c3c4103a..99c604f6 100644 --- a/lua/nvim-treesitter-textobjects/swap.lua +++ b/lua/nvim-treesitter-textobjects/swap.lua @@ -204,7 +204,7 @@ local function make_dot_repeatable(fn) api.nvim_feedkeys('g@l', 'n', false) end ----@param query_strings string lua pattern describing the query string +---@param query_strings string | string[] lua pattern describing the query string ---@param query_group? string function M.swap_next(query_strings, query_group) return make_dot_repeatable(function() @@ -212,7 +212,7 @@ function M.swap_next(query_strings, query_group) end) end ----@param query_strings string lua pattern describing the query string +---@param query_strings string | string[] lua pattern describing the query string ---@param query_group? string function M.swap_previous(query_strings, query_group) return make_dot_repeatable(function()