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

When `cmd` is not provided in config, lua exits with error instead of printing the assertion error

Open ppom0 opened this issue 1 year ago • 0 comments

LSP client configuration

{}

Eclipse.jdt.ls version

irrelevant

Steps to Reproduce

Give an empty config. I think this line causes the errors, because it uses config.cmd in the error message, even if the assertion fails because config.cmd is undefined and therefore not a table: https://github.com/mfussenegger/nvim-jdtls/blob/efe813854432a314b472226dca813f0f2598d44a/lua/jdtls/setup.lua#L312-L316

Expected Result

The assert conditions doesn't fail and prints its helpful message

This will save some time for the next dumb person (like me) who will forget to pass a cmd attribute :wink:

Actual Result

Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: ...l-neovim-unwrapped-0.9.5/share/nvim/runtime/filetype.lua:24: Error executing lua: ...l-neovim-unwrapped-0.9.5/share/nvim/runtime/filetype.lua:25: BufReadPost Autocommands for "*".
.FileType Autocommands for "*"..function <SNR>1_LoadFTPlugin[19]..script /home/ao/.config/nvim/ftplugin/java.lua: Vim(runtime):E5113: Error while calling lua chunk: ...ck/myNeovimPackages/start/nvim-jdtls/lua/jdt
ls/setup.lua:283: bad argument #1 to 'concat' (table expected, got nil)
stack traceback:
        [C]: in function 'concat'
        ...ck/myNeovimPackages/start/nvim-jdtls/lua/jdtls/setup.lua:283: in function 'start_or_attach'
        /home/ao/.config/nvim/ftplugin/java.lua:4: in main chunk
        [C]: in function 'nvim_cmd'
        ...l-neovim-unwrapped-0.9.5/share/nvim/runtime/filetype.lua:25: in function <...l-neovim-unwrapped-0.9.5/share/nvim/runtime/filetype.lua:24>
        [C]: in function 'nvim_buf_call'
        ...l-neovim-unwrapped-0.9.5/share/nvim/runtime/filetype.lua:24: in function <...l-neovim-unwrapped-0.9.5/share/nvim/runtime/filetype.lua:10>
stack traceback:
        [C]: in function 'nvim_cmd'
        ...l-neovim-unwrapped-0.9.5/share/nvim/runtime/filetype.lua:25: in function <...l-neovim-unwrapped-0.9.5/share/nvim/runtime/filetype.lua:24>
        [C]: in function 'nvim_buf_call'
        ...l-neovim-unwrapped-0.9.5/share/nvim/runtime/filetype.lua:24: in function <...l-neovim-unwrapped-0.9.5/share/nvim/runtime/filetype.lua:10>
stack traceback:
        [C]: in function 'nvim_buf_call'
        ...l-neovim-unwrapped-0.9.5/share/nvim/runtime/filetype.lua:24: in function <...l-neovim-unwrapped-0.9.5/share/nvim/runtime/filetype.lua:10>
Press ENTER or type command to continue

ppom0 avatar Oct 10 '24 18:10 ppom0