2023-01-10 02:38:06 +01:00
|
|
|
local env = require("my.helpers.env")
|
|
|
|
|
|
|
|
local M = {
|
|
|
|
"jose-elias-alvarez/null-ls.nvim", -- generic language server
|
|
|
|
event = "BufReadPre",
|
|
|
|
dependencies = "neovim/nvim-lspconfig",
|
|
|
|
cond = env.vscode.not_active(),
|
2023-09-08 19:49:18 +02:00
|
|
|
enable = false,
|
2023-01-10 02:38:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function M.config()
|
|
|
|
local lspconfig = require("my.plugins.lspconfig")
|
|
|
|
local null_ls = require("null-ls")
|
|
|
|
|
|
|
|
local sources = {
|
2023-03-30 02:54:57 +02:00
|
|
|
-- {{{ Typescript formatting
|
|
|
|
-- null_ls.builtins.formatting.prettierd, -- format ts files
|
|
|
|
null_ls.builtins.formatting.prettier, -- format ts files
|
|
|
|
-- }}}
|
|
|
|
-- {{{ Lua formatting
|
|
|
|
-- null_ls.builtins.formatting, -- format lua code
|
|
|
|
null_ls.builtins.formatting.stylua, -- format lua code
|
|
|
|
-- }}}
|
|
|
|
-- {{{ Python
|
|
|
|
-- Formatting:
|
|
|
|
-- null_ls.builtins.formatting.black,
|
|
|
|
-- null_ls.builtins.formatting.isort,
|
|
|
|
null_ls.builtins.formatting.yapf.with({
|
|
|
|
extra_args = { [[--style="{ indent_width: 2 }"]] },
|
|
|
|
}),
|
|
|
|
-- Diagnostics
|
|
|
|
null_ls.builtins.diagnostics.ruff, -- Linting
|
|
|
|
-- null_ls.builtins.diagnostics.mypy, -- Type checking
|
|
|
|
-- }}}
|
2023-01-10 02:38:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
null_ls.setup({
|
|
|
|
sources = sources,
|
|
|
|
on_attach = lspconfig.on_attach,
|
|
|
|
debug = true,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
return M
|