feat(java): Force formatting with null-ls (clang-format) for java projects
This commit is contained in:
parent
d4ffb9a874
commit
876229d65d
|
@ -18,6 +18,18 @@ return {
|
||||||
callback = function(ev)
|
callback = function(ev)
|
||||||
if (ev.match == "java") then
|
if (ev.match == "java") then
|
||||||
require("jdtls").start_or_attach(opts)
|
require("jdtls").start_or_attach(opts)
|
||||||
|
|
||||||
|
local handler = function()
|
||||||
|
vim.lsp.buf.format({
|
||||||
|
async = true,
|
||||||
|
filter = function(client)
|
||||||
|
return client.name == "null-ls"
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
vim.notify("Formatted with null-ls")
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>f", handler, { buffer = ev.buf })
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue