nvim-cmp icon indicating copy to clipboard operation
nvim-cmp copied to clipboard

Error executing lua: Vim:E976: using Blob as a String, Puppeteer completion

Open Abh15h3k opened this issue 2 years ago • 11 comments

FAQ

  • [X] I have checked the FAQ and it didn't resolve my problem.

Issues

  • [X] I have checked existing issues and there are no open or closed issues with the same problem.

Neovim Version

NVIM v0.7.0-dev+1151-g9d3370a14

Minimal reproducible config

same as provided minimal config with following addition

require'lspconfig'.tsserver.setup {
  capabilities = capabilities
}

Description

neovim throws an error before giving suggestions.

Steps to reproduce

open any .js or .ts file in a project where puppeteer is installed and start typing page.keyboard.press('

Expected behavior

suggestions show without any error.

Actual behavior

suggestions show after throwing the following error.

Error executing vim.schedule lua callback: ...are/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/entry.lua:201: Error executing lua: Vim:E976: using Blob as a String
stack traceback:
        [C]: in function 'strdisplaywidth'
        ...are/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/entry.lua:205: in function <...are/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/entry.lua:201>
        [C]: in function 'nvim_buf_call'
        ...are/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/entry.lua:201: in function 'callback'
        ...im/site/pack/packer/opt/nvim-cmp/lua/cmp/utils/cache.lua:36: in function 'get_view'
        ...packer/opt/nvim-cmp/lua/cmp/view/custom_entries_view.lua:122: in function 'open'
        ...hare/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/view.lua:110: in function 'open'
        ...hare/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/core.lua:328: in function 'fn'
        ...im/site/pack/packer/opt/nvim-cmp/lua/cmp/utils/async.lua:41: in function <...im/site/pack/packer/opt/nvim-cmp/lua/cmp/utils/async.lua:39>
stack traceback:
        [C]: in function 'nvim_buf_call'
        ...are/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/entry.lua:201: in function 'callback'
        ...im/site/pack/packer/opt/nvim-cmp/lua/cmp/utils/cache.lua:36: in function 'get_view'
        ...packer/opt/nvim-cmp/lua/cmp/view/custom_entries_view.lua:122: in function 'open'
        ...hare/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/view.lua:110: in function 'open'
        ...hare/nvim/site/pack/packer/opt/nvim-cmp/lua/cmp/core.lua:328: in function 'fn'
        ...im/site/pack/packer/opt/nvim-cmp/lua/cmp/utils/async.lua:41: in function <...im/site/pack/packer/opt/nvim-cmp/lua/cmp/utils/async.lua:39>

Additional context

gif demonstrating the issue.

out

this happens with the press API of puppeteer only. i.e

page.keyboard.press()

const handle = page.waitForSelector('button'); handle.press()

Abh15h3k avatar Mar 01 '22 12:03 Abh15h3k

Thank you for your report. I'll investigate it.

hrsh7th avatar Mar 02 '22 03:03 hrsh7th

I get something similar for lua files:

Error executing vim.schedule lua callback: Vim:E976: using Blob as a String
stack traceback:
        [C]: in function 'strdisplaywidth'
        ...lar/neovim/0.6.1/share/nvim/runtime/lua/vim/lsp/util.lua:1343: in function '_make_floating_popup_size'
        ...lar/neovim/0.6.1/share/nvim/runtime/lua/vim/lsp/util.lua:1203: in function 'stylize_markdown'
        ...te/pack/packer/start/nvim-cmp/lua/cmp/view/docs_view.lua:50: in function 'open'
        ...re/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/view.lua:229: in function 'callback'
        .../site/pack/packer/start/nvim-cmp/lua/cmp/utils/async.lua:95: in function 'cb'
        vim.lua:285: in function <vim.lua:285>

PetarMetodiev avatar Mar 04 '22 18:03 PetarMetodiev

any update on this ?

Abh15h3k avatar Mar 12 '22 03:03 Abh15h3k

any update on this?

Abh15h3k avatar May 04 '22 13:05 Abh15h3k

Also getting this issue and also, when I enter in insert mode for the first time, it delays for 1/2 seconds

BitInByte avatar Jun 29 '22 11:06 BitInByte

Me too, while using it in lua:

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>

lee-shun avatar Mar 04 '23 13:03 lee-shun

Hello! Did you find any solutions? @hrsh7th @Abh15h3k @PetarMetodiev @BitInByte

lee-shun avatar Mar 04 '23 15:03 lee-shun

Hi. Is this issue being worked on ?

Currently i have a hack to hide the error ( not actually fixed the error ).

in window.lua inside cmp changed this line height = height + math.max(1, math.ceil(vim.fn.strdisplaywidth(text) / self.style.width)) to this

local ok, result = pcall(vim.fn.strdisplaywidth, text)
if not ok then result = 0 end
height = height + math.max(1, math.ceil(result / self.style.width))

with this change the error no longer shows. but it is still there. I ultimately resorted to this hack because it was getting very frustrating to have that error come with every keystroke at times.

@hrsh7th Please take a look at the issue.

Edit: I just realized that this will hide the error in some cases only. My current understanding of the issue is that there is some "problem" characters in the text which causes vim.fn.strdisplaywidth to error out.

My hack above fixes this for the doc popup ( I was experiencing this is pyright lsp ) There are other places where the hack can be applied.

Abh15h3k avatar Jul 09 '23 20:07 Abh15h3k

Hi. Is this issue being worked on ?

Currently i have a hack to hide the error ( not actually fixed the error ).

in window.lua inside cmp changed this line height = height + math.max(1, math.ceil(vim.fn.strdisplaywidth(text) / self.style.width)) to this

local ok, result = pcall(vim.fn.strdisplaywidth, text)
if not ok then result = 0 end
height = height + math.max(1, math.ceil(result / self.style.width))

with this change the error no longer shows. but it is still there. I ultimately resorted to this hack because it was getting very frustrating to have that error come with every keystroke at times.

@hrsh7th Please take a look at the issue.

Edit: I just realized that this will hide the error in some cases only. My current understanding of the issue is that there is some "problem" characters in the text which causes vim.fn.strdisplaywidth to error out.

My hack above fixes this for the doc popup ( I was experiencing this is pyright lsp ) There are other places where the hack can be applied.

thanks to your solution. I sloved it temporarily.

youguanxinqing avatar Jul 22 '23 10:07 youguanxinqing