dotfiles/home/config/nvim/ftplugin/java.fnl

20 lines
1 KiB
Text
Raw Normal View History

2022-11-27 16:12:49 +00:00
(let [jdtls (require :jdtls)
project-name (vim.fn.fnamemodify (vim.fn.getcwd) ":p:h:t")
cache-dir (.. (vim.loop.os_homedir) :/.cache/jdtls)
jars-dir (.. cache-dir :/jars)
workspace-dir (.. cache-dir :/workspace/ project-name)
2022-12-10 23:10:33 +00:00
formatter-config (.. cache-dir :/config/formatter. project-name :.xml)
2022-12-16 20:51:35 +00:00
formatter-settings (if (= (vim.fn.filereadable formatter-config) 1)
{:enabled true :settings {:url formatter-config}}
{:enabled false})
2022-11-27 16:12:49 +00:00
config {:cmd [:jdt-language-server :-data workspace-dir]
:root_dir (vim.fs.dirname (. (vim.fs.find [:.gradlew
:.git
:.mvnw]
{:upward true})
2022-12-16 20:51:35 +00:00
1))
:settings {:java {:format formatter-settings}}}]
2022-11-27 16:12:49 +00:00
(set vim.env.JAVA_OPTS (.. "-javaagent:" jars-dir :/lombok.jar))
(jdtls.start_or_attach config))