1
0
Fork 0

nvim: Java formatting

This commit is contained in:
Daniel Kempkens 2022-12-11 00:10:33 +01:00
parent 6450791579
commit 12b53d3d53
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
2 changed files with 2 additions and 0 deletions

View file

@ -3,6 +3,7 @@
cache-dir (.. (vim.loop.os_homedir) :/.cache/jdtls)
jars-dir (.. cache-dir :/jars)
workspace-dir (.. cache-dir :/workspace/ project-name)
formatter-config (.. cache-dir :/config/formatter. project-name :.xml)
config {:cmd [:jdt-language-server :-data workspace-dir]
:root_dir (vim.fs.dirname (. (vim.fs.find [:.gradlew
:.git

View file

@ -42,6 +42,7 @@
(let [formatprg (vim.opt_local.formatprg:get)
formatprg-exe (-> formatprg (vim.split " " {:trimempty true}) (. 1))]
(if (= b.nifoc_formatter_disabled 1) nil
(= b.nifoc_formatter_force_formatprg 1) (run-neoformat formatprg-exe)
(= b.nifoc_lsp_formatter_enabled 1) (vim.lsp.buf.format {:timeout_ms 1000})
(not= formatprg-exe nil) (run-neoformat formatprg-exe))))