Conditionally start jdtls on java buffers
parent
ff9241b096
commit
2ad912368f
|
@ -0,0 +1,4 @@
|
||||||
|
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
|
|
@ -25,7 +25,7 @@ local on_attach = function(client, bufnr)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Lsp default language servers
|
-- Lsp default language servers
|
||||||
local servers = { "bashls", "clangd", "jsonls", "pyright", "rust_analyzer", "kotlin_language_server", "vimls", "clojure_lsp", "gopls", "gdscript" }
|
local servers = { "bashls", "clangd", "jsonls", "pyright", "rust_analyzer", "kotlin_language_server", "vimls", "clojure_lsp", "gopls", "gdscript", "tsserver" }
|
||||||
for _, lsp in ipairs(servers) do
|
for _, lsp in ipairs(servers) do
|
||||||
lspconfig[lsp].setup { on_attach = on_attach }
|
lspconfig[lsp].setup { on_attach = on_attach }
|
||||||
end
|
end
|
||||||
|
@ -54,7 +54,8 @@ lspconfig.omnisharp.setup {
|
||||||
}
|
}
|
||||||
|
|
||||||
-- JDTLS (Java)
|
-- JDTLS (Java)
|
||||||
local jdstls_on_attach = function(client, bufnr)
|
-- Can't be local currently, because autocommand has to be used
|
||||||
|
jdtls_on_attach = function(client, bufnr)
|
||||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||||
|
|
||||||
|
@ -67,8 +68,3 @@ local jdstls_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
|
||||||
|
|
||||||
require('jdtls').start_or_attach {
|
|
||||||
cmd = {'jdtls-startup.sh'};
|
|
||||||
on_attach = jdstls_on_attach;
|
|
||||||
}
|
|
||||||
|
|
|
@ -22,6 +22,24 @@ dap.configurations.python = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local netcoredbg_bin = vim.fn.glob('$HOME') .. "/dap/netcoredbg/netcoredbg"
|
||||||
|
dap.adapters.netcoredbg = {
|
||||||
|
type = 'executable',
|
||||||
|
command = netcoredbg_bin,
|
||||||
|
args = {'--interpreter=vscode'}
|
||||||
|
}
|
||||||
|
|
||||||
|
dap.configurations.cs = {
|
||||||
|
{
|
||||||
|
type = "netcoredbg",
|
||||||
|
name = "launch - netcoredbg",
|
||||||
|
request = "launch",
|
||||||
|
program = function()
|
||||||
|
return vim.fn.input('Path to dll', vim.fn.getcwd() .. '/bin/Debug/', 'file')
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
-- Nvim DAP Treesitter integration
|
-- Nvim DAP Treesitter integration
|
||||||
vim.g.dap_virtual_text = true
|
vim.g.dap_virtual_text = true
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue