echasnovski / mini.nvim

Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
MIT License
4.47k stars 175 forks source link

Completion errors with "'width' key must b e a positive Integer" #885

Closed Jackevansevo closed 1 month ago

Jackevansevo commented 1 month ago

Contributing guidelines

Module(s)

completion

Description

Have tested with both v0.10.0 (brew install neovim) and nightly brew install --HEAD neovim.

Whenever I'm using LSP completion and hit <C-n> I sometimes get an error

Neovim version

v0.10.0

Steps to reproduce

local path_package = vim.fn.stdpath('data') .. '/site'
-- Set up 'mini.deps' (customize to your liking)
require('mini.deps').setup({ path = { package = path_package } })
local add = MiniDeps.add

require('mini.completion').setup()

local add = MiniDeps.add
add('neovim/nvim-lspconfig')

local lspconfig = require('lspconfig')
lspconfig.pylsp.setup{}

Expected behavior

No response

Actual behavior

Error executing vim.schedule lua callback: ...m/site/pack/deps/start/mini.nvim/lua/mini/completion.lua:1265: 'width' key must b
e a positive Integer
stack traceback:
        [C]: in function 'nvim_open_win'
        ...m/site/pack/deps/start/mini.nvim/lua/mini/completion.lua:1265: in function 'open_action_window'
        ...m/site/pack/deps/start/mini.nvim/lua/mini/completion.lua:941: in function <...m/site/pack/deps/start/mini.nvim/lua/m
ini/completion.lua:938>

https://github.com/echasnovski/mini.nvim/assets/4996338/0b1d2162-60c9-479b-b46e-a35088bc92e6

echasnovski commented 1 month ago

Thanks for the issue!

I did not see this in the wild and could not reproduce with 'pyright'. I guess this might happen if LSP server returns empty result.

Would you mind checking if adjusting this line to have return math.max(height, 1), math.max(width, 1) solves the issue?

Jackevansevo commented 1 month ago

Would you mind checking if adjusting this line to have return math.max(height, 1), math.max(width, 1) solves the issue?

Thanks for the fast response, this does indeed fix the issue.

echasnovski commented 1 month ago

This should now be fixed on main branch.