nvim-lspconfig error attempt to concatenate local 'k' (a boolean value)

348 views
Skip to first unread message

Angel Rei

unread,
Jul 3, 2022, 10:17:51 PM7/3/22
to spac...@googlegroups.com

When I upgrade to 2.0.0, error occurred:

 

[dein] Error occurred while executing hook: nvim-lspconfig

[dein] Vim(lua):E5108: Error executing lua ...b/.SpaceVim/bundle/nvim-lspconfig/lua/lspconfig.lua:80: attempt to co

ncatenate local 'k' (a boolean value)

[dein] stack traceback:

[dein] ^I...b/.SpaceVim/bundle/nvim-lspconfig/lua/lspconfig.lua:80: in function '__index'

[dein] ^I[string ":lua"]:49: in main chunk

 

This is my config:

 

#=============================================================================

# basic.toml --- basic configuration example for SpaceVim

# Copyright (c) 2016-2022 Wang Shidong & Contributors

# Author: Wang Shidong < wsd...@outlook.com >

# URL: https://spacevim.org

# License: GPLv3

#=============================================================================

 

# All SpaceVim option below [option] section

[options]

    # set spacevim theme. by default colorscheme layer is not loaded,

    # if you want to use more colorscheme, please load the colorscheme

    # layer

    colorscheme = "gruvbox"

    colorscheme_bg = "dark"

    # Disable guicolors in basic mode, many terminal do not support 24bit

    # true colors

    enable_guicolors = true

    # Disable statusline separator, if you want to use other value, please

    # install nerd fonts

    statusline_separator = "nil"

    statusline_iseparator = "bar"

    buffer_index_type = 4

    windows_index_type = 3

    enable_tabline_filetype_icon = true

    enable_statusline_mode = false

    statusline_unicode = false

    # Enable vim compatible mode, avoid changing origin vim key bindings

    vimcompatible = true

    default_indent = 4

 

# Enable autocomplete layer

[[layers]]

name = 'autocomplete'

auto_completion_return_key_behavior = "complete"

auto_completion_tab_key_behavior = "cycle"

 

[[layers]]

name = 'shell'

default_position = 'top'

default_height = 30

 

[[layers]]

    name = "lang#c"

    clang_executable = "/home/linuxbrew/.linuxbrew/bin/clang"

    enable_clang_syntax_highlight = true

    libclang_path = "/home/linuxbrew/.linuxbrew/lib/libclang.so"

    clang_flags = ["-std=c++2a"]

 

[[layers]]

    name = "lsp"

    filetypes = [

        "c",

        "cpp"

    ]

    enabled_clients = ['clangd']

    [layers.override_cmd]

        c = ["clangd"]

 

[[layers]]

    name = "format"

Dario Meloni

unread,
Jul 17, 2022, 2:49:50 PM7/17/22
to SpaceVim
Both me and Angel Rei report the bug on the same day. Treat them as one

Dario Meloni

unread,
Jul 17, 2022, 2:59:49 PM7/17/22
to SpaceVim
Doing some bisection on the enabled layers.
  • With LSP not enabled and the rest enabled there are no issues
  • With LSP enabled and the reset enabled it fails with that error
  • I disabled all plugins but LSP and the error persists

Alexander Konotop

unread,
Jul 23, 2022, 2:01:49 PM7/23/22
to SpaceVim

Bu I have no idea what exactly causes the trouble. Tried debugging that array/table of configs. It seems empty.
So for me it looks like a BC break in lspconfig which was not accordingly handled by SpaceVim.
Maybe not. I'm trying to figure out how is it lspconfig configured at all, I mean how settings from out config.toml go there. No success currently.

воскресенье, 17 июля 2022 г. в 21:59:49 UTC+3, Dario Meloni:

Alexander Konotop

unread,
Jul 23, 2022, 2:10:14 PM7/23/22
to SpaceVim
Hmmm no, I was wrong. Though I still did not fix anything...

So it blaims it's trying to concatenate a boolean here https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig.lua#L80
Okay, so how did that boolean get there?

It's value is `true`!

суббота, 23 июля 2022 г. в 21:01:49 UTC+3, Alexander Konotop:

Alexander Konotop

unread,
Jul 23, 2022, 2:30:54 PM7/23/22
to SpaceVim
Hmm... So it looks like we have to change in our toml configs:
layers.override_cmd -> layers.override_client_cmds

Also keys should be named as server names (probably). For example: dart->dartls, php->intelephense and so on. I may be wrong.

And anyway there are still two errors. At least while trying to edit a file and insert just a newline it blaims:

Error detected while processing InsertEnter Autocommands for "*":
E5108: Error executing lua .../.SpaceVim/bundle/cmp-nvim-lsp/lua/cmp_nvim_lsp/init.lua:48: loop or previous error loading module 'cmp'
stack traceback:
        [C]: in function 'require'
        .../.SpaceVim/bundle/cmp-nvim-lsp/lua/cmp_nvim_lsp/init.lua:48: in function '_on_insert_enter'
        [string ":lua"]:1: in main chunk
Press ENTER or type command to continue


And while starting there is an old error which occured also before my config fix/rename:

[dein] Error occurred while executing hook: nvim-cmp
[dein] Vim(lua):E5108: Error executing lua /home/alexander/.SpaceVim/bundle/nvim-cmp/lua/cmp/view.lua:5: module 'cmp.view.docs_view' not found:
[dein] ^Ino field package.preload['cmp.view.docs_view']
[dein] ^Ino file './cmp/view/docs_view.lua'

суббота, 23 июля 2022 г. в 21:10:14 UTC+3, Alexander Konotop:

Alexander Konotop

unread,
Jul 23, 2022, 2:50:24 PM7/23/22
to SpaceVim
So the latest issues are fixed by adding nvim-cmp to custom plugins:

[[custom_plugins]]
    repo = "https://github.com/hrsh7th/nvim-cmp.git"
    merged = 0

It looks like currently autocomplete cmp is trying to start before lsp is started. I may be wrong.

Important: after fixing the config of ovverridden commands nvim-lspconfig should be excluded from disabled_plugins.
And if You use cmp autocomplete - You should still have nvim-cmp among custom_plugins.
This way SpaceVim both starts without errors and respects Your lsp config from SpaceVim's toml.
суббота, 23 июля 2022 г. в 21:30:54 UTC+3, Alexander Konotop:

Alexander Konotop

unread,
Jul 23, 2022, 3:05:01 PM7/23/22
to SpaceVim
So as an a conclusion here's a working toml example
[options]
 #    disabled_plugins = ["nvim-lspconfig" ] # do not do that! it is not needed anymore.
    autocomplete_method = "nvim-cmp"
[[custom_plugins]]
    repo = "https://github.com/hrsh7th/nvim-cmp.git"
    merged = 0
[[layers]]
    name = "lsp"
    enabled_clients = [
#        'dartls',
        'gopls',
        'intelephense',
        'rust_analyzer',
        'tsserver'
    ]
    filetypes = [
#        "dart",
        "php",
        "rust",
        "go",
        "typescript",
        "javascript"
    ]
    [layers.override_client_cmds]
      intelephense = ["intelephense", "--stdio"]
#      dartls = [
#          "/opt/flutter/bin/cache/dart-sdk/bin/dart",
#          "/opt/flutter/bin/cache/dart-sdk/bin/snapshots/analysis_server.dart.snapshot",
#          "--lsp"
#      ]
      rust_analyzer = ["rust-analyzer"]
      gopls = ["gopls", "serve"]
      tsserver = ['typescript-language-server', '--stdio']

# and then per-language layers as usual, for example
[[layers]]
    name = "lang#php"

# As You can see, dart is ignored above. Somehow dartls settings are ignored. It blaims that dart_language_server is not executable. I have no idea why. Maybe it's a bug of lspconfig itself
суббота, 23 июля 2022 г. в 21:50:24 UTC+3, Alexander Konotop:

Andy Leon

unread,
Jul 25, 2022, 7:23:00 AM7/25/22
to SpaceVim
Thanks Alexander. Your fix works for me on the LSP config issue. In my case, keeping the default `phpactor` config for PHP, it just needs to be redeclared in the layer...

```
[[layers]]
  name = "lsp"
  enabled_clients = ["phpactor"]
  [layers.override_client_cmds]
    phpactor = ["phpactor", "language-server"]
```

Andy

MJ Wojcik

unread,
Aug 15, 2022, 3:45:38 PM8/15/22
to SpaceVim
Just want to say thanks to Andy! I think I had the exact same issue with phpactor, and your solution worked perfectly!
Reply all
Reply to author
Forward
0 new messages