mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-31 07:09:23 +02:00
java default formatter
This commit is contained in:
parent
0bdba7a00c
commit
3279553481
3 changed files with 30 additions and 1 deletions
|
@ -1,3 +1,28 @@
|
|||
vim.cmd "let proj = FindRootDirectory()"
|
||||
local root_dir = vim.api.nvim_get_var "proj"
|
||||
|
||||
-- use the global prettier if you didn't find the local one
|
||||
local prettier_instance = root_dir .. "/node_modules/.bin/prettier"
|
||||
if vim.fn.executable(prettier_instance) ~= 1 then
|
||||
prettier_instance = O.lang.tsserver.formatter.exe
|
||||
end
|
||||
|
||||
O.formatters.filetype["java"] = {
|
||||
function()
|
||||
return {
|
||||
exe = prettier_instance,
|
||||
-- TODO: allow user to override this
|
||||
args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0) },
|
||||
stdin = true,
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
||||
require("formatter.config").set_defaults {
|
||||
logging = false,
|
||||
filetype = O.formatters.filetype,
|
||||
}
|
||||
|
||||
if require("lv-utils").check_lsp_client_active "jdtls" then
|
||||
return
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue