Skip to content

Commit

Permalink
fix null-ls formatting conflicts;
Browse files Browse the repository at this point in the history
  • Loading branch information
walcht committed Dec 25, 2023
1 parent 758f112 commit baf862c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
1 change: 0 additions & 1 deletion after/plugin/lsp_related/lspconfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ servers['bashls'] = default_config
servers['yamlls'] = default_config
servers['lemminx'] = default_config
servers['tsserver'] = default_config
servers['jdtls'] = default_config
-------------------------------------------------------------------------------------------------------------
-- Ensure installed servers
local ensure_installed = {}
Expand Down
30 changes: 21 additions & 9 deletions after/plugin/lsp_related/null_ls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,28 @@ local formatting = null_ls.builtins.formatting
local diagnostics = null_ls.builtins.diagnostics
local code_actions = null_ls.builtins.code_actions
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
-- before adding any new linters/formatters, make sure that you add them to Mason's list of
-- linters_and_formatters. That way they are ensured to be installed and managed through Mason!
-- before adding any new linters/formatters, make sure that you add them to
-- Mason's list of linters_and_formatters. That way they are ensured to be
-- installed and managed through Mason!
null_ls.setup({
sources = {
--------------------------------------------- FORMATTERS --------------------------------------------
-------------------------------- FORMATTERS ---------------------------
formatting.black.with({
extra_args = { "--line-length=88" }
extra_args = { "--line-length=110" }
}),
formatting.markdownlint,
formatting.csharpier,
-----------------------------------------------------------------------------------------------------
--------------------------------------------- DIAGNOSTICS -------------------------------------------
formatting.prettierd,
formatting.latexindent,
-----------------------------------------------------------------------
------------------------------- DIAGNOSTICS ---------------------------
diagnostics.ruff,
diagnostics.markdownlint,
diagnostics.jsonlint,
-----------------------------------------------------------------------------------------------------
diagnostics.deno_lint,
-----------------------------------------------------------------------
------------------------------- CODE ACTIONS --------------------------
code_actions.eslint_d,
-----------------------------------------------------------------------
},
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
Expand All @@ -31,7 +37,13 @@ null_ls.setup({
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format()
vim.lsp.buf.format({
filter = function(client)
return client.name == "null-ls"
end,
bufnr = bufnr,
async = false
})
end,
})
end
Expand Down
2 changes: 0 additions & 2 deletions lua/unitynvim/commands.lua

This file was deleted.

1 change: 0 additions & 1 deletion lua/unitynvim/init.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
if vim.loader then vim.loader.enable() end
for _, source in ipairs {
"unitynvim.plugins",
"unitynvim.commands",
"unitynvim.keymaps",
"unitynvim.settings",
} do
Expand Down

0 comments on commit baf862c

Please sign in to comment.