aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2022-06-11 19:26:05 +0200
committerInigoGutierrez <inigogf.95@gmail.com>2022-06-11 19:26:05 +0200
commit8a5a2d699986193158a03010b685c0d8cd9623ac (patch)
treec67f1f610fa370af5f1705ec87a4e9c7b737bb1a
parentc5367645c3e8f51866ca34cfbaa6c14cf8772022 (diff)
downloadconfigs-8a5a2d699986193158a03010b685c0d8cd9623ac.tar.gz
configs-8a5a2d699986193158a03010b685c0d8cd9623ac.zip
Apparently added an ftplugin for java development in nvim 6 months ago.
-rw-r--r--stow/nvim/.config/nvim/ftplugin/java.lua53
1 files changed, 53 insertions, 0 deletions
diff --git a/stow/nvim/.config/nvim/ftplugin/java.lua b/stow/nvim/.config/nvim/ftplugin/java.lua
new file mode 100644
index 0000000..25e1d4d
--- /dev/null
+++ b/stow/nvim/.config/nvim/ftplugin/java.lua
@@ -0,0 +1,53 @@
+local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t')
+local workspace_dir = '/home/taamas/proyects/java-workspaces/' .. project_name
+
+-- See `:help vim.lsp.start_client` for an overview of the supported `config` options.
+local config = {
+ -- The command that starts the language server
+ -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line
+ cmd = {
+
+ 'java', -- or '/path/to/java11_or_newer/bin/java'
+ -- depends on if `java` is in your $PATH env variable and if it points to the right version.
+
+ '-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',
+ '--add-modules=ALL-SYSTEM',
+ '--add-opens', 'java.base/java.util=ALL-UNNAMED',
+ '--add-opens', 'java.base/java.lang=ALL-UNNAMED',
+
+ '-jar', '/usr/share/java/jdtls/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar',
+
+ '-configuration', '/usr/share/java/jdtls/config_linux',
+
+ '-data', workspace_dir
+ },
+
+ --root_dir = require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'}),
+
+ -- Here you can configure eclipse.jdt.ls specific settings
+ -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request
+ -- for a list of options
+ settings = {
+ java = {
+ }
+ },
+
+ -- Language server `initializationOptions`
+ -- You need to extend the `bundles` with paths to jar files
+ -- if you want to use additional eclipse.jdt.ls plugins.
+ --
+ -- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation
+ --
+ -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this
+ init_options = {
+ bundles = {}
+ },
+}
+-- This starts a new client & server,
+-- or attaches to an existing client & server depending on the `root_dir`.
+require('jdtls').start_or_attach(config)