p00f / clangd_extensions.nvim

Clangd's off-spec features for neovim's LSP client. Use https://sr.ht/~p00f/clangd_extensions.nvim instead
MIT License
448 stars 16 forks source link

Error executing vim.schedule lua callback: switch_source_header.lua:3 #54

Closed po6ix closed 3 months ago

po6ix commented 3 months ago

Error Message

Error executing vim.schedule lua callback: ...ions.nvim/lua/clangd_extensions/switch_source_header.lua:3: Expected 3 arguments
stack traceback:
        [C]: in function 'nvim_echo'
        ...ions.nvim/lua/clangd_extensions/switch_source_header.lua:3: in function 'handler'
        ...w/Cellar/neovim/0.9.5/share/nvim/runtime/lua/vim/lsp.lua:1393: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

NVIM version

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1710088188

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.5/share/nvim"

Run :checkhealth for more info

Problematic Part

local function handler(_err, uri)
    if not uri or uri == "" then
        vim.api.nvim_echo("Corresponding file cannot be determined", false) -- ***[1]*** throw Error!
    -- ...
end

vim.api.nvim_echo expects three arguments, but only two are provided.

Proposal

local function handler(_err, uri)
    if not uri or uri == "" then
        vim.api.nvim_echo({ { "Corresponding file cannot be determined" } }, false, {}) -- ***[1]*** changed line
-- ...

This change will make it work as intended.

p00f commented 3 months ago

fixed, thanks