aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2021-01-08 17:02:03 -0800
committerMichael Lingelbach <m.j.lbach@gmail.com>2021-01-08 17:02:03 -0800
commitd540f8233cc8736fff55a5daede965cf39cdc0d4 (patch)
tree6839d80be284d2caf02d90fb519d448b29821678 /lua
parentMerge pull request #559 from pierreprinetti/readme_typo (diff)
downloadnvim-lspconfig-d540f8233cc8736fff55a5daede965cf39cdc0d4.tar
nvim-lspconfig-d540f8233cc8736fff55a5daede965cf39cdc0d4.tar.gz
nvim-lspconfig-d540f8233cc8736fff55a5daede965cf39cdc0d4.tar.bz2
nvim-lspconfig-d540f8233cc8736fff55a5daede965cf39cdc0d4.tar.lz
nvim-lspconfig-d540f8233cc8736fff55a5daede965cf39cdc0d4.tar.xz
nvim-lspconfig-d540f8233cc8736fff55a5daede965cf39cdc0d4.tar.zst
nvim-lspconfig-d540f8233cc8736fff55a5daede965cf39cdc0d4.zip
jdtls: fix cmd and fix java documentation
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/jdtls.lua38
1 files changed, 38 insertions, 0 deletions
diff --git a/lua/lspconfig/jdtls.lua b/lua/lspconfig/jdtls.lua
index 85440946..2c8ecd28 100644
--- a/lua/lspconfig/jdtls.lua
+++ b/lua/lspconfig/jdtls.lua
@@ -5,8 +5,34 @@ local path = util.path
local server_name = "jdtls"
+cmd = {
+ tostring(vim.fn.getenv("JAVA_HOME")).."/bin/java",
+ "-Declipse.application=org.eclipse.jdt.ls.core.id1",
+ "-Dosgi.bundles.defaultStartLevel=4",
+ "-Declipse.product=org.eclipse.jdt.ls.core.product",
+ "-Dlog.protocol=true",
+ "-Dlog.level=ALL",
+ "-Xms1g",
+ "-Xmx2G",
+ "-jar",
+ tostring(vim.fn.getenv("JAR")),
+ "-configuration",
+ tostring(vim.fn.getenv("JDTLS_CONFIG")),
+ "-data",
+ tostring(vim.fn.getenv("WORKSPACE")),
+ "--add-modules=ALL-SYSTEM",
+ "--add-opens java.base/java.util=ALL-UNNAMED",
+ "--add-opens java.base/java.lang=ALL-UNNAMED",
+}
+
+print(vim.inspect(cmd))
configs[server_name] = {
default_config = {
+ cmd = cmd,
+ cmd_env = {
+ JAR=vim.fn.getenv("JAR"),
+ GRADLE_HOME=vim.fn.getenv("GRADLE_HOME"),
+ },
filetypes = { "java" };
root_dir = util.root_pattern('.git');
init_options = {
@@ -42,11 +68,23 @@ configs[server_name] = {
};
docs = {
description = [[
+
https://projects.eclipse.org/projects/eclipse.jdt.ls
Language server for Java.
See project page for installation instructions.
+
+Due to the nature of java, the settings for eclipse jdtls cannot be automatically
+inferred. Please set the following environmental variables to match your installation. You can set these locally for your project with the help of [direnv](https://github.com/direnv/direnv). Note version numbers will change depending on your project's version of java, your version of eclipse, and in the case of JDTLS_CONFIG, your OS.
+
+```bash
+export JAR=/path/to/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/plugins/org.eclipse.equinox.launcher_1.6.0.v20200915-1508.jar
+export GRADLE_HOME=$HOME/gradle
+export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.9.11-9.fc33.x86_64/
+export JDLTS_CONFIG=/path/to/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/config_linux
+export WORKSPACE=$HOME/workspace
+```
]];
default_config = {
root_dir = [[root_pattern(".git")]];