mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-04 18:14:40 +02:00
update LSP get nvim-jdtls working with Java
This commit is contained in:
parent
51aa582272
commit
e26b5c51ed
8 changed files with 66 additions and 0 deletions
15
lua/lsp/java-ls.lua
Normal file
15
lua/lsp/java-ls.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
-- 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
|
||||
require('jdtls').start_or_attach({cmd = {JAVA_LS_EXECUTABLE}, root_dir = require('jdtls.setup').find_root({'gradle.build', 'pom.xml'})})
|
10
lua/lsp/json-ls.lua
Normal file
10
lua/lsp/json-ls.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
-- npm install -g vscode-json-languageserver
|
||||
require'lspconfig'.jsonls.setup {
|
||||
commands = {
|
||||
Format = {
|
||||
function()
|
||||
vim.lsp.buf.range_formatting({},{0,0},{vim.fn.line("$"),0})
|
||||
end
|
||||
}
|
||||
}
|
||||
}
|
2
lua/lsp/python-ls.lua
Normal file
2
lua/lsp/python-ls.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
-- npm i -g pyright
|
||||
require'lspconfig'.pyright.setup{}
|
2
lua/lsp/yaml-ls.lua
Normal file
2
lua/lsp/yaml-ls.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
-- npm install -g yaml-language-server
|
||||
require'lspconfig'.yamlls.setup{}
|
Loading…
Add table
Add a link
Reference in a new issue