For example, I want to launch clangd with flags --completion-style=detailed --header-insertion=never
. What arguments should I pass when calling setup{}
?
I think you can do:
require("lspconfig").clangd.setup({
cmd = {
"clangd",
"--completion-style=detailed",
"--header-insertion=never",
},
-- other options
})
It works.
Another question about lua: If I write this,
local servers = { "clangd", "rust_analyzer" }
local command = {}
command.clangd = {
"clangd",
"--completion-style=detailed",
"--header-insertion=never",
}
local lspconfig = require("lspconfig")
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
cmd = command[lsp]
}
end
Is it OK when starting rust-analyzer?
Yep, it should be okay. Not having any value means it’s nil
, so it’ll fallback to the default value.
I got it. Thank you!