lsp: lua_ls
This commit is contained in:
parent
778106c705
commit
80cf9083d3
1 changed files with 30 additions and 11 deletions
41
init.lua
41
init.lua
|
|
@ -153,6 +153,18 @@ local servers = {
|
|||
gopls = {},
|
||||
jsonls = {},
|
||||
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 = {},
|
||||
pylsp = {},
|
||||
rust_analyzer = {},
|
||||
|
|
@ -166,10 +178,17 @@ local servers = {
|
|||
-- Auto format on save
|
||||
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||
callback = function()
|
||||
if next(vim.lsp.get_active_clients()) == nil then
|
||||
cmd("Format")
|
||||
else
|
||||
local lsp_format = false
|
||||
for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
lsp_format = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if lsp_format then
|
||||
vim.lsp.buf.format({ async = false })
|
||||
else
|
||||
cmd("Format")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
@ -181,13 +200,13 @@ g.ale_go_golangci_lint_package = 1
|
|||
---- nvim-lint ----
|
||||
local lint = require("lint")
|
||||
local clippy_format = "%E%f:%l:%c: %\\d%#:%\\d%# %.%\\{-}"
|
||||
.. "error:%.%\\{-} %m,%W%f:%l:%c: %\\d%#:%\\d%# %.%\\{-}"
|
||||
.. "warning:%.%\\{-} %m,%C%f:%l %m,%-G,%-G"
|
||||
.. "error: aborting %.%#,%-G"
|
||||
.. "error: Could not compile %.%#,%E"
|
||||
.. "error: %m,%Eerror[E%n]: %m,%-G"
|
||||
.. "warning: the option `Z` is unstable %.%#,%W"
|
||||
.. "warning: %m,%Inote: %m,%C %#--> %f:%l:%c"
|
||||
.. "error:%.%\\{-} %m,%W%f:%l:%c: %\\d%#:%\\d%# %.%\\{-}"
|
||||
.. "warning:%.%\\{-} %m,%C%f:%l %m,%-G,%-G"
|
||||
.. "error: aborting %.%#,%-G"
|
||||
.. "error: Could not compile %.%#,%E"
|
||||
.. "error: %m,%Eerror[E%n]: %m,%-G"
|
||||
.. "warning: the option `Z` is unstable %.%#,%W"
|
||||
.. "warning: %m,%Inote: %m,%C %#--> %f:%l:%c"
|
||||
|
||||
-- clippy --
|
||||
lint.linters.clippy = {
|
||||
|
|
@ -215,7 +234,7 @@ lint.linters.yamllint.args = {
|
|||
args = { "--format=parsable", "-d relaxed" },
|
||||
}
|
||||
|
||||
linters = {
|
||||
local linters = {
|
||||
bash = { "shellcheck" },
|
||||
dockerfile = { "hadolint" },
|
||||
go = { "golangcilint" },
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue