From 4ae4152a2be7149267ef63827b9dbd91e6780e26 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 13 Oct 2024 10:00:00 +0200 Subject: [PATCH] feat(ghost_text): don't error when snippet parsing fails --- lua/care/ghost_text.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/care/ghost_text.lua b/lua/care/ghost_text.lua index 1a97cad..f04841a 100644 --- a/lua/care/ghost_text.lua +++ b/lua/care/ghost_text.lua @@ -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()