aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-treesitter/ts_utils.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/lua/nvim-treesitter/ts_utils.lua b/lua/nvim-treesitter/ts_utils.lua
index 655c62881..9e9ada6aa 100644
--- a/lua/nvim-treesitter/ts_utils.lua
+++ b/lua/nvim-treesitter/ts_utils.lua
@@ -397,6 +397,7 @@ function M.swap_nodes(node_or_range1, node_or_range2, bufnr, cursor_to_second)
local edit1 = { range = range1, newText = table.concat(text2, "\n") }
local edit2 = { range = range2, newText = table.concat(text1, "\n") }
+ bufnr = bufnr == 0 and vim.api.nvim_get_current_buf() or bufnr
vim.lsp.util.apply_text_edits({ edit1, edit2 }, bufnr, "utf-8")
if cursor_to_second then