From e28fb7a730b1bd425fdddfdbd3d36bb84bd77611 Mon Sep 17 00:00:00 2001 From: Yuta Katayama <8683947+yutkat@users.noreply.github.com> Date: Mon, 24 Apr 2023 13:58:46 +0900 Subject: [PATCH] fix: Use vim.treesitter.get_node_text() to avoid deprecation warning (#1499) --- lua/cmp/config/compare.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/cmp/config/compare.lua b/lua/cmp/config/compare.lua index 3aad33495..de8a12001 100644 --- a/lua/cmp/config/compare.lua +++ b/lua/cmp/config/compare.lua @@ -203,7 +203,8 @@ compare.scopes = setmetatable({ for _, definition in pairs(definitions) do if s <= definition.node:start() and definition.node:end_() <= e then if scope:id() == locals.containing_scope(definition.node, buf):id() then - local text = vim.treesitter.query.get_node_text(definition.node, buf) or '' + local get_node_text = vim.treesitter.get_node_text or vim.treesitter.query.get_node_text + local text = get_node_text(definition.node, buf) or '' if not self.scopes_map[text] then self.scopes_map[text] = depth end