|
@@ -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
|
|
if require("lv-utils").check_lsp_client_active "jdtls" then
|
|
return
|
|
return
|
|
end
|
|
end
|