nvim config stolen from @Lukacms
This commit is contained in:
37
nvim/lua/lsp/null-ls.lua
Normal file
37
nvim/lua/lsp/null-ls.lua
Normal file
@@ -0,0 +1,37 @@
|
||||
local null_ls = require("null-ls")
|
||||
local b = null_ls.builtins
|
||||
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/pull/804
|
||||
local buf_path_in_workflow_folder = function()
|
||||
local api = vim.api
|
||||
local path = api.nvim_buf_get_name(api.nvim_get_current_buf())
|
||||
return path:match("github/workflows/") ~= nil
|
||||
end
|
||||
|
||||
local sources = {
|
||||
b.diagnostics.actionlint.with({
|
||||
runtime_condition = buf_path_in_workflow_folder,
|
||||
}),
|
||||
|
||||
function()
|
||||
local nl_utils = require("null-ls.utils").make_conditional_utils()
|
||||
return nl_utils.root_has_file({ ".prettierrc.json", ".prettierrc" })
|
||||
and b.formatting.prettierd.with({ filetypes = { "html", "javascript", "typescript", "svelte" } })
|
||||
or b.formatting.eslint_d
|
||||
end,
|
||||
|
||||
b.formatting.black,
|
||||
b.formatting.stylua,
|
||||
}
|
||||
|
||||
local M = {}
|
||||
|
||||
M.setup = function(on_attach)
|
||||
null_ls.setup({
|
||||
debug = false,
|
||||
sources = sources,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user