Skip to content

Commit

Permalink
fix: pcall get_parser call
Browse files Browse the repository at this point in the history
  • Loading branch information
theHamsta committed Dec 25, 2024
1 parent 76d80c3 commit df66808
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lua/nvim-dap-virtual-text/virtual_text.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ function M.set_virtual_text(stackframe, options)
if not lang then
return
end
parser = vim.treesitter.get_parser(buf, lang)
local ok
ok, parser = pcall(vim.treesitter.get_parser, buf, lang)
if not ok then
return
end
else
local require_ok, parsers = pcall(require, 'nvim-treesitter.parsers')
if not require_ok then
Expand All @@ -112,7 +116,11 @@ function M.set_virtual_text(stackframe, options)
if not lang then
return
end
parser = parsers.get_parser(buf, lang)
local ok
ok, parser = pcall(parsers.get_parser, buf, lang)
if not ok then
return
end
end

local scope_nodes = {}
Expand Down

0 comments on commit df66808

Please sign in to comment.