fix: configure logging for the LSPs.

This commit is contained in:
Dan Anglin 2022-05-18 07:51:50 +01:00
parent 5c1fb279d2
commit c8a336773d
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638

View file

@ -1,5 +1,7 @@
local ok, lspconfig = pcall(require, "lspconfig")
local log_directory = vim.env.LOG_HOME
if not ok then
return
end
@ -40,7 +42,7 @@ end
-- Go
lspconfig.gopls.setup{
on_attach = custom_attach,
cmd = {"gopls", "serve"},
cmd = {"gopls", "serve", "-logfile="..log_directory.."/gopls.log"},
settings = {
gopls = {
analyses = {
@ -64,12 +66,13 @@ lspconfig.golangci_lint_ls.setup{}
-- Jsonnet
lspconfig.jsonnet_ls.setup{
on_attach = custom_attach,
cmd = {"jsonnet-language-server", "--lint"},
}
-- Terraform
lspconfig.terraformls.setup{
on_attach = custom_attach,
cmd = {"terraform-ls", "serve"},
cmd = {"terraform-ls", "serve", "-log-file="..log_directory.."/terraformls.log"},
filetypes = {"terraform", "hcl", "tf"},
root_dir = lspconfig.util.root_pattern{".terraform", ".git", "main.tf"},
}