OlegGulevskyy / better-ts-errors.nvim

MIT License
117 stars 7 forks source link

Crashing when trying to view an error #17

Open liamwh opened 1 month ago

liamwh commented 1 month ago

Description

   Error  15:11:37 msg_show.lua_error E5108: Error executing lua ...b/.local/share/nvim/lazy/nui.nvim/lua/nui/utils/init.lua:29: Invalid window id: 1000
stack traceback:
    [C]: in function 'nvim_win_get_width'
    ...b/.local/share/nvim/lazy/nui.nvim/lua/nui/utils/init.lua:29: in function 'get_window_size'
    ....local/share/nvim/lazy/nui.nvim/lua/nui/layout/utils.lua:94: in function 'get_container_info'
    ....local/share/nvim/lazy/nui.nvim/lua/nui/layout/utils.lua:161: in function 'update_layout_config'
    ...b/.local/share/nvim/lazy/nui.nvim/lua/nui/popup/init.lua:388: in function 'update_layout'
    ...azy/better-ts-errors.nvim/lua/better-ts-errors/popup.lua:25: in function 'show'
    ...tter-ts-errors.nvim/lua/better-ts-errors/diagnostics.lua:138: in function 'show'
    ...lazy/better-ts-errors.nvim/lua/better-ts-errors/main.lua:31: in function 'toggle'
    ...lazy/better-ts-errors.nvim/lua/better-ts-errors/init.lua:11: in function 'toggle'
    [string ":lua"]:1: in main chunk

Steps to reproduce

<leader>dd on an error in a svelte file

Expected behaviour

The UI to show the formatted error

Environment

NVIM v0.10.1 Build type: Release LuaJIT 2.1.1720049189

OlegGulevskyy commented 1 month ago

Hm, I am not sure how to reproduce it, it looks like an error is coming from nui which is used to show the popup window. Here is Svelte file on my side image

Does this happen in a specific project? On all svelte files? Does it happen on any other types of files (react etc)? I don't see a type of file being an issue, since there is no runtime use of the types of files. You can open this window even in Lua files and it doesn't use TS Server image

Do you know which Nui version you have installed?

walker-tx commented 1 month ago

I had the same issue (using LazyVim). I just needed to install the nui package itself:

-- ./lua/plugins/nui.lua
return {
    "MunifTanjim/nui.nvim",
    lazy = true,
}

I guess having it listed as a dependency wasn't enough?

OlegGulevskyy commented 1 month ago

Thanks for confirmation! That's weird that listing it as a dependency is not enough.

I will take a look if I can pinpoint why and if it's the plugin who is doing something wrong or a package manager

walker-tx commented 1 month ago

Okay, so that didn't actually solve the problem completely, it's just intermittent now.

E5108: Error executing lua ...r/.local/share/nvim/lazy/nui.nvim/lua/nui/utils/init.lua:29: Invalid window id: 1000
stack traceback:
        [C]: in function 'nvim_win_get_width'
        ...r/.local/share/nvim/lazy/nui.nvim/lua/nui/utils/init.lua:29: in function 'get_window_size'
        ....local/share/nvim/lazy/nui.nvim/lua/nui/layout/utils.lua:94: in function 'get_container_info'
        ....local/share/nvim/lazy/nui.nvim/lua/nui/layout/utils.lua:161: in function 'update_layout_config'
        ...r/.local/share/nvim/lazy/nui.nvim/lua/nui/popup/init.lua:388: in function 'update_layout'
        ...azy/better-ts-errors.nvim/lua/better-ts-errors/popup.lua:25: in function 'show'
        ...tter-ts-errors.nvim/lua/better-ts-errors/diagnostics.lua:138: in function 'show'
        ...lazy/better-ts-errors.nvim/lua/better-ts-errors/main.lua:31: in function 'toggle'
        ...lazy/better-ts-errors.nvim/lua/better-ts-errors/init.lua:11: in function 'toggle'
        [string ":lua"]:1: in main chunk

There seems to be similar issues reported:

Looks like Telescope was causing this issue for a bit, but it's been patched it seems:

It may be worthwhile to check and see that what caused their problem is not also causing the issue here.

If it's not an issue w/ this plugin, I'm wondering if @liamwh and I have a similar plugin that's surfacing this issue - one that you don't have?

This is my :Lazy output:

alpha-nvim
better-ts-errors.nvim
catpuccin
cmp-nvim-lsp
cmp-vsnip
lazy.nvim
lspkind-nvim
lualine.nvim
mason-lspconfig.nvim
mason.nvim
mini.comment
mini.pairs
neo-tree.nvim
neodev.nvim
none-ls-extras.nvim
none-ls.nvim
nui.nvim
nvim-cmp
nvim-lspconfig
nvim-surround
nvim-treesitter
nvim-web-devicons
plenary.nvim
schemastore.nvim
tailwind-tools
telescope-ui-select.nvim
telescope.nvim
tokyonight.nvim
vim-vsnip