mirror of
https://github.com/windwp/nvim-ts-autotag.git
synced 2024-12-28 21:19:16 -06:00
fix: add pcall to other uses of vim.treesitter.get_parser
This commit is contained in:
parent
5c93dfdfb3
commit
3d96e2c9f1
@ -243,8 +243,8 @@ local function check_close_tag(close_slash_tag)
|
||||
end
|
||||
|
||||
M.close_tag = function()
|
||||
local buf_parser = vim.treesitter.get_parser()
|
||||
if not buf_parser then
|
||||
local ok, buf_parser = pcall(vim.treesitter.get_parser)
|
||||
if not ok then
|
||||
return
|
||||
end
|
||||
buf_parser:parse(true)
|
||||
@ -256,8 +256,8 @@ M.close_tag = function()
|
||||
end
|
||||
|
||||
M.close_slash_tag = function()
|
||||
local buf_parser = vim.treesitter.get_parser()
|
||||
if not buf_parser then
|
||||
local ok, buf_parser = pcall(vim.treesitter.get_parser)
|
||||
if not ok then
|
||||
return
|
||||
end
|
||||
buf_parser:parse(true)
|
||||
|
@ -65,8 +65,8 @@ M.get_node_at_cursor = function(winnr)
|
||||
local row, col = unpack(vim.api.nvim_win_get_cursor(winnr))
|
||||
row = row - 1
|
||||
local buf = vim.api.nvim_win_get_buf(winnr)
|
||||
local root_lang_tree = vim.treesitter.get_parser(buf)
|
||||
if not root_lang_tree then
|
||||
local ok, root_lang_tree = pcall(vim.treesitter.get_parser, buf)
|
||||
if not ok then
|
||||
return
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user