Skip to content

Overriding "command_parameters" in LSP Client not work as expected #913

Description

@Old-Rockin-Chair-Joe

I need to add --query-driver.

In your default lspclient.json:

    {
      "language": "c",
      "name": "clangd",
      "url": "https://clangd.llvm.org/",
      "command": "clangd",
      "command_parameters": "-log=error --background-index --header-insertion=never --limit-results=0 --limit-references=0 --clang-tidy=0 --completion-style=bundled -j $NPROC",
      "share_process": true,
      "file_patterns": ["%.c$", "%.h$", "%.C$", "%.H$", "%.objc$"]
    },
    {
      "language": "cpp",
      "use": "clangd",
      "share_process": true,
      "file_patterns": ["%.inl$", "%.cpp$", "%.hpp$", "%.cc$", "%.cxx$", "%.c++$", "%.hh$", "%.hxx$", "%.h++$", "%.objcpp$"]
    },
    {
      "language": "objective-c",
      "use": "clangd",
      "share_process": true,
      "file_patterns": ["%.m$"]
    },
    {
      "language": "objective-cpp",
      "use": "clangd",
      "share_process": true,
      "file_patterns": ["%.mm$"]
    },

OK. So C++ just reuse the template for C.

I don't want to mess with the template for C, so I tried this in my local lspclient.json:

  "servers": [
    {
      "command_parameters": "-log=error --background-index --query-driver=D:\\Tools\\c++.exe --header-insertion=never --limit-results=0 --limit-references=0 --clang-tidy=0 --completion-style=bundled -j $NPROC",
      "language" : "cpp"
    }
  ]

That doesn't work.

So I have no way other than overriding the template for C itself:

  "servers": [
    {
      "command_parameters": "-log=error --background-index --query-driver=D:\\Tools\\c++.exe --header-insertion=never --limit-results=0 --limit-references=0 --clang-tidy=0 --completion-style=bundled -j $NPROC",
      "name": "clangd"
    }
  ]

Nope. Also doesn't work.

It took me a while to figure out that the override itself doesn’t work, and that the issue isn’t with clangd, by checking the internal console with F12. The language server is still launched with the default "command_parameters".

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions