From 20ed47e21e966a5b857ef9970ae6171b3a504ce1 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Thu, 1 Jul 2021 23:42:26 -0400 Subject: lsp in ftplugin austonautomoy --- ftplugin/java.lua | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 ftplugin/java.lua (limited to 'ftplugin/java.lua') diff --git a/ftplugin/java.lua b/ftplugin/java.lua new file mode 100644 index 00000000..0b151b66 --- /dev/null +++ b/ftplugin/java.lua @@ -0,0 +1,50 @@ +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 + +-- 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'lsp'.common_on_attach(client, bufr) +end + +require'lspconfig'.jdtls.setup { + on_attach = 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"}, +-- root_dir = require('jdtls.setup').find_root({'build.gradle', 'pom.xml', '.git'}), +-- init_options = {bundles = bundles} +-- }) + +-- TODO setup autoformat stuff later + -- _java = { + -- -- {'FileType', 'java', 'luafile '..CONFIG_PATH..'/lua/lsp/java-ls.lua'}, + -- { + -- 'FileType', 'java', + -- 'nnoremap ca lua require(\'jdtls\').code_action()' + -- } + -- } -- cgit v1.2.3