Skip to content

Commit

Permalink
feat(ghost_text): don't error when snippet parsing fails
Browse files Browse the repository at this point in the history
  • Loading branch information
max397574 committed Oct 20, 2024
1 parent c752b4e commit 4ae4152
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/care/ghost_text.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ function Ghost_text.new()

if self.entry.completion_item.insertTextFormat == 2 then
-- TODO: replace with stable api once available
text = tostring(vim.lsp._snippet_grammar.parse(text))
local ok, parsed = pcall(vim.lsp._snippet_grammar.parse, text)
if ok then
text = tostring(parsed)
end
end

local offset = self.entry:get_offset()
Expand Down

0 comments on commit 4ae4152

Please sign in to comment.