summaryrefslogtreecommitdiff
path: root/ftplugin/java.lua
diff options
context:
space:
mode:
authorChris <[email protected]>2021-07-09 01:37:03 -0400
committerChris <[email protected]>2021-07-09 01:37:03 -0400
commitd539ec951c1ccfd904afa0a1680d34a46619eea3 (patch)
tree6e2fa8ab009be2db33c514bc5a15e01b7bca8694 /ftplugin/java.lua
parent1154032f64eec889e12d4e39ce141ed1bc8f4f28 (diff)
java tool working on mac
Diffstat (limited to 'ftplugin/java.lua')
-rw-r--r--ftplugin/java.lua54
1 files changed, 30 insertions, 24 deletions
diff --git a/ftplugin/java.lua b/ftplugin/java.lua
index 6feaa31e..a1a84ff4 100644
--- a/ftplugin/java.lua
+++ b/ftplugin/java.lua
@@ -2,36 +2,42 @@ if require("lv-utils").check_lsp_client_active "jdtls" then
return
end
-local util = require "lspconfig/util"
--- In Vimscript
--- augroup lsp
--- au!
--- au FileType java lua require('jdtls').start_or_attach({cmd = {'java-linux-ls'}})
--- 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 O.lang.java.java_tools.active then
+ print "hi"
+ -- find_root looks for parent directories relative to the current buffer containing one of the given arguments.
+ if vim.fn.has "mac" == 1 then
+ JAVA_LS_EXECUTABLE = CONFIG_PATH .. "/utils/bin/java-mac-ls"
+ WORKSPACE_PATH = "/Users/" .. USER .. "/workspace/"
+ elseif vim.fn.has "unix" == 1 then
+ JAVA_LS_EXECUTABLE = CONFIG_PATH .. "/utils/bin/java-linux-ls"
+ WORKSPACE_PATH = "/home/" .. USER .. "/workspace/"
+ else
+ print "Unsupported system"
+ end
+ print(JAVA_LS_EXECUTABLE)
+ print(WORKSPACE_PATH)
+
+ require("jdtls").start_or_attach {
+ cmd = { JAVA_LS_EXECUTABLE, WORKSPACE_PATH .. vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") },
+ }
+else
+ local util = require "lspconfig/util"
+
+ require("lspconfig").jdtls.setup {
+ on_attach = require("lsp").common_on_attach,
+ 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
+ }
+end
-- local bundles = {
-- vim.fn.glob(
-- CONFIG_PATH.."/.debuggers/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar")
-- };
-require("lspconfig").jdtls.setup {
- on_attach = require("lsp").common_on_attach,
- 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"},