Skip to content

Commit

Permalink
fix: dont error if cmp not loaded when overriding
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Nov 29, 2022
1 parent e657003 commit 4bae487
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lua/noice/lsp/override.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ local M = {}

function M.setup()
if Config.options.lsp.override["cmp.entry.get_documentation"] then
require("cmp.entry").get_documentation = function(self)
local item = self:get_completion_item()
if item.documentation then
return Format.format_markdown(item.documentation)
pcall(function()
require("cmp.entry").get_documentation = function(self)
local item = self:get_completion_item()
if item.documentation then
return Format.format_markdown(item.documentation)
end
return {}
end
return {}
end
end)
end

if Config.options.lsp.override["vim.lsp.util.convert_input_to_markdown_lines"] then
Expand Down

0 comments on commit 4bae487

Please sign in to comment.