Bug rust analyzer lsp config

42 views
Skip to first unread message

ValouBambou

unread,
Jul 27, 2022, 6:24:19 PM7/27/22
to spac...@googlegroups.com
Hi,

Thanks for this amazing project ! It helps me a lot as a vim newbie. I encountered a little issue when setting up rust lsp support with rust-analyzer.  The buggy config is this one
```
[options]
    colorscheme = "onedark"
    colorscheme_bg = "dark"
    enable_guicolors = true
    statusline_separator = "arrow"
    statusline_iseparator = "arrow"
    buffer_index_type = 4
    enable_tabline_filetype_icon = true
    enable_statusline_mode = false
    default_indent = 4

[[layers]]
    name = "lsp"
    filetypes = [
        "rust",
        "python",
        "c",
        "ocaml"
    ]
    enabled_clients = ["clangd", "ocamllsp", "rust_analyzer", "pylsp"]
    [layers.override_cmd]
    python = ["pylsp"]
    ocaml = ["ocamllsp"]


[[layers]]
name = 'autocomplete'
auto_completion_return_key_behavior = "complete"
auto_completion_tab_key_behavior = "smart"

[[layers]]
  name = "format"
  format_on_save = true

[[layers]]
name = 'shell'
default_position = 'top'
default_height = 30

[[layers]]
  name = "colorscheme"

[[layers]]
  name = 'git'
[[layers]]
  name = 'VersionControl'

[[layers]]
  name = "denite"

[[layers]]
  name = "lang#rust"

[[layers]]
  name = "lang#ocaml"

[[layers]]
  name = "lang#python"
  python_interpreter = "/usr/bin/python"
  enabled_linters = ['python', 'pylint']
```

It raises this error when staring neovim:
```
[dein] Error occurred while executing hook: nvim-lspconfig
[dein] Vim(lua):E5108: Error executing lua ...lentin/.SpaceVim/bundle/nvim-lspconfig/lua/lspconfig.lua
:80: attempt to concatenate local 'k' (a boolean value)
[dein] stack traceback:
[dein] ^I...lentin/.SpaceVim/bundle/nvim-lspconfig/lua/lspconfig.lua:80: in function '__index'
[dein] ^I[string ":lua"]:49: in main chunk
```

Inspired by this post https://groups.google.com/g/spacevim/c/E5C9zXU_Xk8?pli=1 I added those 2 lines in the lsp layer, and it fixed it.  It might be a bug, maybe be there is a typo "rust_analyzer" instead of "rust-analyzer" somewhere, but I'm not really sure of what happened.

```
[layers.override_client_cmds]
rust_analyzer = ["rust-analyzer"]
```

I hope this message may help you in some way.

Have a nive day/night, and again thanks to you for this amazing work on SpaceVim !

ValouBambou
Reply all
Reply to author
Forward
0 new messages