Fix jdtls configuration

pull/1/head
Ensar Sarajčić 2021-06-11 13:15:36 +02:00
parent 2ad912368f
commit 746ed155d5
4 changed files with 9 additions and 4 deletions

View File

@ -0,0 +1,4 @@
require('jdtls').start_or_attach {
cmd = {'jdtls-startup.sh'};
on_attach = require'lsp.servers'.jdtls_on_attach;
}

View File

@ -1,4 +0,0 @@
augroup lsp
au!
au FileType java lua require('jdtls').start_or_attach({cmd = {'jdtls-startup.sh'}; on_attach = require'lsp.servers'.jdtls_on_attach})
augroup end

View File

@ -16,6 +16,7 @@ local on_attach = function(client, bufnr)
buf_set_keymap('n', '<C-]>', '<cmd>lua vim.lsp.buf.definition()<CR>', default_opts) buf_set_keymap('n', '<C-]>', '<cmd>lua vim.lsp.buf.definition()<CR>', default_opts)
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', default_opts) buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', default_opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', default_opts) buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', default_opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', default_opts)
buf_set_keymap('n', '<Leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', default_opts) buf_set_keymap('n', '<Leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', default_opts)
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', default_opts) buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', default_opts)
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', default_opts) buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', default_opts)
@ -68,3 +69,7 @@ jdtls_on_attach = function(client, bufnr)
buf_set_keymap('n', '<A-CR>', "<cmd>lua require('jdtls').code_action()<CR>", default_opts) buf_set_keymap('n', '<A-CR>', "<cmd>lua require('jdtls').code_action()<CR>", default_opts)
buf_set_keymap('n', '<Leader>ac', "<cmd>lua require('jdtls').code_action()<CR>", default_opts) buf_set_keymap('n', '<Leader>ac', "<cmd>lua require('jdtls').code_action()<CR>", default_opts)
end end
return {
jdtls_on_attach = jdtls_on_attach
}