diff options
author | Marek Filipowicz <[email protected]> | 2021-06-26 19:15:02 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-26 13:15:02 -0400 |
commit | a9e904711843374d85ca8a454fd70fc9890180ad (patch) | |
tree | b216b5706d09c20e87817892fe5b99b2677b9589 /lua/lsp/java-ls.lua | |
parent | 19003f7577f360b5b2ced84ac1e23202660d0f79 (diff) |
feat(java): Replace the current custom installation of java, with lspinstall (#517)
Diffstat (limited to 'lua/lsp/java-ls.lua')
-rw-r--r-- | lua/lsp/java-ls.lua | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/lua/lsp/java-ls.lua b/lua/lsp/java-ls.lua index 88f12498..90985ff4 100644 --- a/lua/lsp/java-ls.lua +++ b/lua/lsp/java-ls.lua @@ -1,3 +1,4 @@ +local util = require 'lspconfig/util' -- In Vimscript -- augroup lsp -- au! @@ -5,27 +6,36 @@ -- augroup end -- find_root looks for parent directories relative to the current buffer containing one of the given arguments. -- require'lspconfig'.jdtls.setup {cmd = {'java-linux-ls'}} -if vim.fn.has("mac") == 1 then - JAVA_LS_EXECUTABLE = 'java-mac-ls' -elseif vim.fn.has("unix") == 1 then - JAVA_LS_EXECUTABLE = 'java-linux-ls' -else - print("Unsupported system") -end +-- if vim.fn.has("mac") == 1 then +-- JAVA_LS_EXECUTABLE = 'java-mac-ls' +-- elseif vim.fn.has("unix") == 1 then +-- JAVA_LS_EXECUTABLE = 'java-linux-ls' +-- else +-- print("Unsupported system") +-- end -local bundles = { - vim.fn.glob( - CONFIG_PATH.."/.debuggers/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar") -}; +-- local bundles = { +-- vim.fn.glob( +-- CONFIG_PATH.."/.debuggers/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar") +-- }; local on_attach = function(client, bufr) - require('jdtls').setup_dap() + -- require('jdtls').setup_dap() require'lsp'.common_on_attach(client, bufr) end -require('jdtls').start_or_attach({ +require'lspconfig'.jdtls.setup { on_attach = on_attach, - cmd = {JAVA_LS_EXECUTABLE}, - root_dir = require('jdtls.setup').find_root({'build.gradle', 'pom.xml', '.git'}), - init_options = {bundles = bundles} -}) + cmd = {DATA_PATH .. "/lspinstall/java/jdtls.sh"}, + filetypes = { "java" }, + root_dir = util.root_pattern({'.git', 'build.gradle', 'pom.xml'}), + -- init_options = {bundles = bundles} + -- on_attach = require'lsp'.common_on_attach +} + +-- require('jdtls').start_or_attach({ +-- on_attach = on_attach, +-- cmd = {DATA_PATH .. "/lspinstall/java/jdtls.sh"}, +-- root_dir = require('jdtls.setup').find_root({'build.gradle', 'pom.xml', '.git'}), +-- init_options = {bundles = bundles} +-- }) |