From 7a1c677985b8fc4cdfdb87dd55fbc16dadd86bbe Mon Sep 17 00:00:00 2001 From: TheSafdarAwan Date: Tue, 4 Apr 2023 02:44:56 +0500 Subject: [PATCH] fix: `vim.treesitter.query.get_node_text` deprecated --- lua/nvim-ts-autotag/utils.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/nvim-ts-autotag/utils.lua b/lua/nvim-ts-autotag/utils.lua index 17950ee..fd66137 100644 --- a/lua/nvim-ts-autotag/utils.lua +++ b/lua/nvim-ts-autotag/utils.lua @@ -1,10 +1,10 @@ local _, ts_utils = pcall(require, 'nvim-treesitter.ts_utils') local log = require('nvim-ts-autotag._log') -local get_node_text = vim.treesitter.query.get_node_text or ts_utils.get_node_text +local get_node_text = vim.treesitter.get_node_text or vim.treesitter.query.get_node_text or ts_utils.get_node_text local M = {} M.get_node_text = function(node) - local txt = get_node_text(node, vim.api.nvim_get_current_buf()) + local _, txt = pcall(get_node_text, node, vim.api.nvim_get_current_buf()) return vim.split(txt, '\n') or {} end