Switch to vim.lsp.config and vim.lsp.enable
This commit is contained in:
@@ -1,82 +1,3 @@
|
|||||||
vim.bo.expandtab = true
|
vim.bo.expandtab = true
|
||||||
vim.bo.tabstop = 4
|
vim.bo.tabstop = 4
|
||||||
vim.bo.shiftwidth = 4
|
vim.bo.shiftwidth = 4
|
||||||
|
|
||||||
require'lsphelp'
|
|
||||||
|
|
||||||
local jdtls_home = os.getenv('HOME') .. '/Projects/lsp/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository'
|
|
||||||
local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t')
|
|
||||||
local jdtls = require'jdtls'
|
|
||||||
|
|
||||||
-- The on_attach function is used to set key maps after the language server
|
|
||||||
-- attaches to the current buffer
|
|
||||||
local on_attach = function(client, bufnr)
|
|
||||||
default_on_attach(client, bufnr)
|
|
||||||
|
|
||||||
-- Java extensions provided by jdtls
|
|
||||||
nnoremap("<C-o>", jdtls.organize_imports, bufopts, "Organize imports")
|
|
||||||
nnoremap("<space>ev", jdtls.extract_variable, bufopts, "Extract variable")
|
|
||||||
nnoremap("<space>ec", jdtls.extract_constant, bufopts, "Extract constant")
|
|
||||||
vim.keymap.set('v', "<space>em", [[<ESC><CMD>lua require('jdtls').extract_method(true)<CR>]],
|
|
||||||
{ noremap=true, silent=true, buffer=bufnr, desc = "Extract method" })
|
|
||||||
end
|
|
||||||
|
|
||||||
-- See `:help vim.lsp.start_client` for an overview of the supported `config` options.
|
|
||||||
local config = {
|
|
||||||
on_attach = on_attach, -- We pass our on_attach keybindings to the configuration map
|
|
||||||
flags = {
|
|
||||||
debounce_text_changes = 150,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- The command that starts the language server
|
|
||||||
-- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line
|
|
||||||
cmd = {
|
|
||||||
'java',
|
|
||||||
|
|
||||||
'-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', jdtls_home .. '/plugins/org.eclipse.equinox.launcher_1.6.900.v20240613-2009.jar',
|
|
||||||
'-configuration', jdtls_home .. '/config_linux',
|
|
||||||
'-data', os.getenv('HOME') .. '/.cache/jdtls/' .. project_name
|
|
||||||
},
|
|
||||||
|
|
||||||
-- This is the default if not provided, you can remove it. Or adjust as needed.
|
|
||||||
-- One dedicated LSP server & client will be started per unique root_dir
|
|
||||||
root_dir = vim.fs.root(0, {'.git', 'mvnw', 'gradlew', 'build.gradle'}),
|
|
||||||
|
|
||||||
-- 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 = {
|
|
||||||
signatureHelp = { enabled = true },
|
|
||||||
jdt = {
|
|
||||||
ls = {
|
|
||||||
androidSupport = { enabled = true },
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
-- 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`.
|
|
||||||
jdtls.start_or_attach(config)
|
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
require'lsphelp'
|
require'lsphelp'
|
||||||
local nvim_lsp = require('lspconfig')
|
|
||||||
|
|
||||||
nvim_lsp['hls'].setup {
|
vim.lsp.config('hls', {
|
||||||
on_attach = default_on_attach,
|
on_attach = default_on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
flags = {
|
flags = {
|
||||||
@@ -16,8 +15,10 @@ nvim_lsp['hls'].setup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
nvim_lsp['intelephense'].setup {
|
vim.lsp.enable('hls')
|
||||||
|
|
||||||
|
vim.lsp.config('intelephense', {
|
||||||
on_attach = default_on_attach,
|
on_attach = default_on_attach,
|
||||||
flags = {
|
flags = {
|
||||||
debounce_text_changes = 150
|
debounce_text_changes = 150
|
||||||
@@ -34,12 +35,16 @@ nvim_lsp['intelephense'].setup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
nvim_lsp['clangd'].setup {
|
vim.lsp.enable('intelephense')
|
||||||
|
|
||||||
|
vim.lsp.config('clangd', {
|
||||||
on_attach = default_on_attach,
|
on_attach = default_on_attach,
|
||||||
capabilities = capabilities
|
capabilities = capabilities
|
||||||
}
|
})
|
||||||
require("flutter-tools").setup {
|
vim.lsp.enable('clangd')
|
||||||
|
|
||||||
|
require('flutter-tools').setup {
|
||||||
outline = {
|
outline = {
|
||||||
open_cmd = "Vista"
|
open_cmd = "Vista"
|
||||||
},
|
},
|
||||||
@@ -48,20 +53,23 @@ require("flutter-tools").setup {
|
|||||||
capabilities = capabilities
|
capabilities = capabilities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nvim_lsp['twiggy_language_server'].setup {
|
|
||||||
|
vim.lsp.config('twiggy_language_server', {
|
||||||
on_attach = default_on_attach,
|
on_attach = default_on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
settings = {
|
settings = {
|
||||||
twiggy = {
|
twiggy = {
|
||||||
framework = 'symfony',
|
framework = 'symfony',
|
||||||
phpExecutable = '/usr/bin/php',
|
phpExecutable = 'php',
|
||||||
symfonyConsolePath = 'bin/console',
|
symfonyConsolePath = 'bin/console',
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
twigCsFixer = false
|
twigCsFixer = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
vim.lsp.enable('twiggy_language_server')
|
||||||
|
|
||||||
vim.g.vim_vue_plugin_config = {
|
vim.g.vim_vue_plugin_config = {
|
||||||
syntax = {
|
syntax = {
|
||||||
template = {'html'},
|
template = {'html'},
|
||||||
|
Reference in New Issue
Block a user