feat: add terraform lsp & lint
This commit is contained in:
parent
dc0e0fa634
commit
aaab5e3b57
3 changed files with 63 additions and 60 deletions
|
@ -1,24 +1,25 @@
|
|||
local options = {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
css = { "prettier" },
|
||||
html = { "prettier" },
|
||||
python = { "ruff_format", "ruff_fix", "ruff_organize_imports" },
|
||||
go = { "goimports", "gofmt" },
|
||||
json = { "jq" },
|
||||
},
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
css = { "prettier" },
|
||||
html = { "prettier" },
|
||||
python = { "ruff_format", "ruff_fix", "ruff_organize_imports" },
|
||||
tf = { "tflint", "terraform-ls" },
|
||||
go = { "goimports", "gofmt" },
|
||||
json = { "jq" },
|
||||
},
|
||||
|
||||
format_on_save = {
|
||||
-- These options will be passed to conform.format()
|
||||
timeout_ms = 500,
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
-- Set the log level. Use `:ConformInfo` to see the location of the log file.
|
||||
log_level = vim.log.levels.ERROR,
|
||||
-- Conform will notify you when a formatter errors
|
||||
notify_on_error = true,
|
||||
-- Conform will notify you when no formatters are available for the buffer
|
||||
notify_no_formatters = true,
|
||||
format_on_save = {
|
||||
-- These options will be passed to conform.format()
|
||||
timeout_ms = 500,
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
-- Set the log level. Use `:ConformInfo` to see the location of the log file.
|
||||
log_level = vim.log.levels.ERROR,
|
||||
-- Conform will notify you when a formatter errors
|
||||
notify_on_error = true,
|
||||
-- Conform will notify you when no formatters are available for the buffer
|
||||
notify_no_formatters = true,
|
||||
}
|
||||
|
||||
return options
|
||||
|
|
|
@ -1,53 +1,54 @@
|
|||
local configs = require "nvchad.configs.lspconfig"
|
||||
local configs = require("nvchad.configs.lspconfig")
|
||||
configs.defaults()
|
||||
|
||||
local servers = {
|
||||
html = {},
|
||||
cssls = {},
|
||||
gopls = {
|
||||
analyses = {
|
||||
unusedparams = true,
|
||||
},
|
||||
staticcheck = true,
|
||||
gofumpt = true,
|
||||
},
|
||||
ruff = {
|
||||
lint = {
|
||||
run = "onSave",
|
||||
},
|
||||
},
|
||||
zls = {},
|
||||
html = {},
|
||||
cssls = {},
|
||||
gopls = {
|
||||
analyses = {
|
||||
unusedparams = true,
|
||||
},
|
||||
staticcheck = true,
|
||||
gofumpt = true,
|
||||
},
|
||||
ruff = {
|
||||
lint = {
|
||||
run = "onSave",
|
||||
},
|
||||
},
|
||||
zls = {},
|
||||
terraformls = {},
|
||||
|
||||
pyright = {
|
||||
settings = {
|
||||
python = {
|
||||
analysis = {
|
||||
autoSearchPaths = true,
|
||||
typeCheckingMode = "basic",
|
||||
},
|
||||
venvPath = vim.fn.getcwd() .. "/.venv",
|
||||
pythonPath = vim.fn.getcwd() .. "/.venv/bin/python3",
|
||||
},
|
||||
},
|
||||
},
|
||||
ts_ls = {
|
||||
settings = {
|
||||
completions = {
|
||||
completeFunctionCalls = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
pyright = {
|
||||
settings = {
|
||||
python = {
|
||||
analysis = {
|
||||
autoSearchPaths = true,
|
||||
typeCheckingMode = "basic",
|
||||
},
|
||||
venvPath = vim.fn.getcwd() .. "/.venv",
|
||||
pythonPath = vim.fn.getcwd() .. "/.venv/bin/python3",
|
||||
},
|
||||
},
|
||||
},
|
||||
ts_ls = {
|
||||
settings = {
|
||||
completions = {
|
||||
completeFunctionCalls = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
configs.on_attach(client, bufnr)
|
||||
client.server_capabilities.documentFormattingProvider = true
|
||||
configs.on_attach(client, bufnr)
|
||||
client.server_capabilities.documentFormattingProvider = true
|
||||
end
|
||||
|
||||
for name, opts in pairs(servers) do
|
||||
opts.on_init = configs.on_init
|
||||
opts.on_attach = on_attach
|
||||
opts.capabilities = configs.capabilities
|
||||
opts.on_init = configs.on_init
|
||||
opts.on_attach = on_attach
|
||||
opts.capabilities = configs.capabilities
|
||||
|
||||
require("lspconfig")[name].setup(opts)
|
||||
require("lspconfig")[name].setup(opts)
|
||||
end
|
||||
|
|
|
@ -25,6 +25,7 @@ return {
|
|||
"python",
|
||||
"typescript",
|
||||
"go",
|
||||
"terraform",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue