Skip to content

Commit 22be02f

Browse files
committed
fix: pcall get_parser call
1 parent 76d80c3 commit 22be02f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lua/nvim-dap-virtual-text/virtual_text.lua

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ function M.set_virtual_text(stackframe, options)
102102
if not lang then
103103
return
104104
end
105-
parser = vim.treesitter.get_parser(buf, lang)
105+
local ok
106+
ok, parser = pcall(vim.treesitter.get_parser, buf, lang)
107+
if not ok then
108+
return
109+
end
106110
else
107111
local require_ok, parsers = pcall(require, 'nvim-treesitter.parsers')
108112
if not require_ok then
@@ -112,7 +116,11 @@ function M.set_virtual_text(stackframe, options)
112116
if not lang then
113117
return
114118
end
115-
parser = parsers.get_parser(buf, lang)
119+
local ok
120+
ok, parser = pcall(parsers.get_parser, buf, lang)
121+
if not ok then
122+
return
123+
end
116124
end
117125

118126
local scope_nodes = {}

0 commit comments

Comments
 (0)