fix: vim.treesitter.query.get_node_text deprecated

This commit is contained in:
TheSafdarAwan 2023-04-04 02:44:56 +05:00 committed by windwp
parent 25698e4033
commit 7a1c677985

View File

@ -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