folke / noice.nvim

💥 Highly experimental plugin that completely replaces the UI for messages, cmdline and the popupmenu.
Apache License 2.0
4.3k stars 100 forks source link

cmp and noice bug when choosing in the cmp popup menu #383

Closed lee-shun closed 1 year ago

lee-shun commented 1 year ago

Did you check docs and existing issues?

Neovim version (nvim -v)

0.9.0-dev

Operating system/version

ubuntu 20.04

Describe the bug

When I use noice.nvim with cmp, when choosing in the popup menu, it shows the following errors:

Error executing vim.schedule lua callback: Vim:E976: using Blob as a String
stack traceback:
    [C]: in function 'strlen'
    ...ls/.local/share/nvim/lazy/nui.nvim/lua/nui/text/init.lua:26: in function 'set'
    ...ls/.local/share/nvim/lazy/nui.nvim/lua/nui/text/init.lua:16: in function 'init'
    .../.local/share/nvim/lazy/nui.nvim/lua/nui/object/init.lua:132: in function 'NuiText'
    ...ls/.local/share/nvim/lazy/nui.nvim/lua/nui/line/init.lua:19: in function '_append'
    ...ocal/share/nvim/lazy/noice.nvim/lua/noice/text/block.lua:187: in function 'append'
    ...l/share/nvim/lazy/noice.nvim/lua/noice/text/markdown.lua:196: in function 'format'
    ...al/share/nvim/lazy/noice.nvim/lua/noice/lsp/override.lua:37: in function 'stylize_markdown'
    ...ocal/share/nvim/lazy/nvim-cmp/lua/cmp/view/docs_view.lua:54: in function 'open'
    /home/ls/.local/share/nvim/lazy/nvim-cmp/lua/cmp/view.lua:238: in function 'callback'
    .../.local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/async.lua:111: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>

When I disable the opts.lsp.override, I got

Error executing vim.schedule lua callback: Vim:E976: using Blob as a String
stack traceback:
    [C]: in function 'strdisplaywidth'
    /usr/share/nvim/runtime/lua/vim/lsp/util.lua:1508: in function '_make_floating_popup_size'
    /usr/share/nvim/runtime/lua/vim/lsp/util.lua:1355: in function 'stylize_markdown'
    ...ocal/share/nvim/lazy/nvim-cmp/lua/cmp/view/docs_view.lua:54: in function 'open'
    /home/ls/.local/share/nvim/lazy/nvim-cmp/lua/cmp/view.lua:238: in function 'callback'
    .../.local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/async.lua:111: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>

Steps To Reproduce

  1. use the following snippet:

noice config: exactly the same as LazyNvim settings...

Expected Behavior

work with no errors...

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  "folke/noice.nvim",
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
folke commented 1 year ago

this is not a noice issues as it clearly also happens without noice. It seems your getting binary data through cmp from an lsp server somehow

lee-shun commented 1 year ago

Ok, I will try to ask it in the cmp repo. Thanks a lot