1
0
Fork 0

lsp: lua_ls

This commit is contained in:
Felipe 2023-04-18 01:46:22 -04:00
parent 778106c705
commit 80cf9083d3
Signed by: pitbuster
SSH key fingerprint: SHA256:HDYu2Pm4/TmSX8GBwV49UvFWr1Ljg8XlHxKeCpjJpOk

View file

@ -153,6 +153,18 @@ local servers = {
gopls = {}, gopls = {},
jsonls = {}, jsonls = {},
kotlin_language_server = {}, kotlin_language_server = {},
lua_ls = {
settings = {
Lua = {
runtime = { version = "LuaJIT" },
diagnostics = { globals = { "vim" } },
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
},
telemetry = { enable = false },
},
},
},
marksman = {}, marksman = {},
pylsp = {}, pylsp = {},
rust_analyzer = {}, rust_analyzer = {},
@ -166,10 +178,17 @@ local servers = {
-- Auto format on save -- Auto format on save
vim.api.nvim_create_autocmd({ "BufWritePre" }, { vim.api.nvim_create_autocmd({ "BufWritePre" }, {
callback = function() callback = function()
if next(vim.lsp.get_active_clients()) == nil then local lsp_format = false
cmd("Format") for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do
else if client.server_capabilities.documentFormattingProvider then
lsp_format = true
break
end
end
if lsp_format then
vim.lsp.buf.format({ async = false }) vim.lsp.buf.format({ async = false })
else
cmd("Format")
end end
end, end,
}) })
@ -181,13 +200,13 @@ g.ale_go_golangci_lint_package = 1
---- nvim-lint ---- ---- nvim-lint ----
local lint = require("lint") local lint = require("lint")
local clippy_format = "%E%f:%l:%c: %\\d%#:%\\d%# %.%\\{-}" local clippy_format = "%E%f:%l:%c: %\\d%#:%\\d%# %.%\\{-}"
.. "error:%.%\\{-} %m,%W%f:%l:%c: %\\d%#:%\\d%# %.%\\{-}" .. "error:%.%\\{-} %m,%W%f:%l:%c: %\\d%#:%\\d%# %.%\\{-}"
.. "warning:%.%\\{-} %m,%C%f:%l %m,%-G,%-G" .. "warning:%.%\\{-} %m,%C%f:%l %m,%-G,%-G"
.. "error: aborting %.%#,%-G" .. "error: aborting %.%#,%-G"
.. "error: Could not compile %.%#,%E" .. "error: Could not compile %.%#,%E"
.. "error: %m,%Eerror[E%n]: %m,%-G" .. "error: %m,%Eerror[E%n]: %m,%-G"
.. "warning: the option `Z` is unstable %.%#,%W" .. "warning: the option `Z` is unstable %.%#,%W"
.. "warning: %m,%Inote: %m,%C %#--> %f:%l:%c" .. "warning: %m,%Inote: %m,%C %#--> %f:%l:%c"
-- clippy -- -- clippy --
lint.linters.clippy = { lint.linters.clippy = {
@ -215,7 +234,7 @@ lint.linters.yamllint.args = {
args = { "--format=parsable", "-d relaxed" }, args = { "--format=parsable", "-d relaxed" },
} }
linters = { local linters = {
bash = { "shellcheck" }, bash = { "shellcheck" },
dockerfile = { "hadolint" }, dockerfile = { "hadolint" },
go = { "golangcilint" }, go = { "golangcilint" },