custom config null-ls

This commit is contained in:
asep komarudin 2023-02-19 18:43:34 +07:00
parent ca7eebe161
commit bfff75c0a4
2 changed files with 31 additions and 13 deletions

8
lua/custom/null-ls.lua Normal file
View file

@ -0,0 +1,8 @@
local null_ls = require("null-ls")
local formatting = null_ls.builtins.formatting
local m = {
sources = {
formatting.stylua, -- tambahkan di bawah sini
},
}
return m

View file

@ -10,21 +10,31 @@ local diagnostics = null_ls.builtins.diagnostics
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
local sources = {}
local data_exists, data = pcall(require, "custom.null-ls")
if data_exists then
for _, cfg in pairs(data.sources) do
table.insert(sources, cfg)
end
end
null_ls.setup({
debug = false,
sources = {
--formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }),
--formatting.prettier,
-- formatting.prettierd,
-- formatting.black.with({ extra_args = { "--fast" } }),
-- formatting.stylua,
-- formatting.eslint_d,
-- formatting.google_java_format,
-- formatting.phpcbf,
-- formatting.clang_format,
-- diagnostics.flake8
-- diagnostics.eslint_d,
},
sources = sources,
--sources = {
--formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }),
--formatting.prettier,
-- formatting.prettierd,
-- formatting.black.with({ extra_args = { "--fast" } }),
-- formatting.stylua,
-- formatting.eslint_d,
-- formatting.google_java_format,
-- formatting.phpcbf,
-- formatting.clang_format,
-- diagnostics.flake8
-- diagnostics.eslint_d,
--},
-- on_attach = function(client, bufnr)
-- --if client.resolved_capabilities.document_formatting then