williamboman / nvim-lsp-installer

Further development has moved to https://github.com/williamboman/mason.nvim!
https://github.com/williamboman/mason.nvim
Apache License 2.0
2k stars 123 forks source link

Expected table got boolean #490

Closed anoopd closed 2 years ago

anoopd commented 2 years ago

Problem description

After i installed and configured a few language servers with the help of nvim-lsp-installer i am getting the error [nvim-lsp-installer] vim/shared.lua:0: after the second argument: expected table, got boolean

I am not that familiar with lua , so am not sure whether i am doing something wrong in my configs or is it something to do with the plugin itself .

Neovim version (>= 0.6)

NVIM v0.7.0-dev Build type: RelWithDebInfo LuaJIT 2.1.0-beta3

Operating system/version

inux anoops-ubuntu 5.13.0-28-generic #31~20.04.1-Ubuntu SMP Wed Jan 19 14:08:10 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

I've recently downloaded the latest plugin version of both nvim-lsp-installer and nvim-lspconfig

Affected language servers

all

Actual behavior

Error on starting nvim

Expected behavior

Nvim should start without any errors

Healthcheck output

nvim-lsp-installer: require("nvim-lsp-installer.health").check()
========================================================================
## nvim-lsp-installer report
  - OK: neovim version >= 0.6.0
  - WARNING: **Go**: not available
  - WARNING: **Ruby**: not available
  - WARNING: **RubyGem**: not available
  - WARNING: **julia**: not available
  - OK: **sh**: `Ok`
  - OK: **bash**: `GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)`
  - OK: **tar**: `tar (GNU tar) 1.30`
  - OK: **gzip**: `gzip 1.10`
  - OK: **wget**: `GNU Wget 1.20.3 built on linux-gnu.`
  - OK: **python3**: `Python 3.8.10`
  - OK: **node**: `v15.7.0`
  - OK: **PHP**: `PHP 8.0.13 (cli) (built: Nov 22 2021 09:50:43) ( NTS )`
  - OK: **curl**: `curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3`
  - OK: **npm**: `7.21.1`
  - OK: **java**: `Ok`
  - OK: **Composer**: `Composer version 1.10.24 2021-12-09 20:06:33`
  - OK: **javac**: `Ok`
  - OK: **pip3**: `pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)`

Screenshots

No response

williamboman commented 2 years ago

Hey this is most likely due to some error happening inside the function you provide to lsp_installer.on_server_ready(). I'd recommend commenting out that function line by line until it (hopefully) stops erroring

anoopd commented 2 years ago

Thank you for the response . Will try it and let you know .

anoopd commented 2 years ago

I tried it and after commenting out everything , the error vanished . I couldn't find out what i have messed up .

lsp_installer.on_server_ready(function(server)
    local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol
        .make_client_capabilities())
    local opts = {capabilities = capabilities}

    if server.name == "sumneko_lua" then
        opts = vim.tbl_deep_extend("force", {
            settings = {
                Lua = {
                    runtime = {version = 'LuaJIT', path = vim.split(package.path, ';')},
                    diagnostics = {globals = {'vim'}},
                    workspace = {library = vim.api.nvim_get_runtime_file("", true), checkThirdParty = false},
                    telemetry = {enable = false}
                }
            }

        }, opts)
    end
    server:setup(opts)
end)

Do you think there is something wrong with the code ?

williamboman commented 2 years ago

That seems fine to me, it also works if I use it in the minimal_debug_init.lua

anoopd commented 2 years ago

Ok then ..... let me go through it once more . The problem is i am not familiar with lua, but will try to find out .

anoopd commented 2 years ago

Ok so i had it solved . It was because i had a error while calling the settings from another file .