From 0ceca4ec740f89d2fa4e556c427289485c69d44c Mon Sep 17 00:00:00 2001 From: Rocky Zhang Date: Sat, 23 Nov 2024 13:21:06 -0800 Subject: [PATCH] fix: offset_encoding is required now Adapt to the upstream change https://github.com/neovim/neovim/commit/629483e24eed3f2c07e55e0540c553361e0345a2 --- lua/nvim-treesitter/textobjects/lsp_interop.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/nvim-treesitter/textobjects/lsp_interop.lua b/lua/nvim-treesitter/textobjects/lsp_interop.lua index d89d2ead..aa9a1a01 100644 --- a/lua/nvim-treesitter/textobjects/lsp_interop.lua +++ b/lua/nvim-treesitter/textobjects/lsp_interop.lua @@ -111,7 +111,11 @@ function M.peek_definition_code(query_string, query_group, lsp_request, context) if vim.tbl_contains(vim.api.nvim_list_wins(), floating_win) then vim.api.nvim_set_current_win(floating_win) else - local params = vim.lsp.util.make_position_params() + local win_id = vim.api.nvim_get_current_win() + local params = vim.fn.has "nvim-0.11" == 0 and vim.lsp.util.make_position_params() + or function(client) + return vim.api.util.make_position_params(win_id, client.offset_encoding) + end return vim.lsp.buf_request( 0, lsp_request,