Add start_opts arg to start_or_attach

Alternative to https://github.com/mfussenegger/nvim-jdtls/pull/556
This commit is contained in:
Mathias Fussenegger 2023-11-01 08:37:45 +01:00 committed by Mathias Fußenegger
parent 7356238ee3
commit 503a399e0d
3 changed files with 20 additions and 9 deletions

View file

@ -1,13 +1,18 @@
==============================================================================
LSP extensions for Neovim and eclipse.jdt.ls *jdtls*
M.start_or_attach({config}) *jdtls.start_or_attach*
*jdtls.start_or_attach*
M.start_or_attach({config}, {opts?}, {start_opts?})
Start the language server (if not started), and attach the current buffer.
Parameters: ~
{config} (table) configuration. See |vim.lsp.start_client|
@return integer? client_id
{config} (table<string,any>) configuration. See |vim.lsp.start_client|
{opts?} (jdtls.start.opts)
{start_opts?} (lsp.StartOpts) options passed to vim.lsp.start
Returns: ~
(integer|nil) client_id
M.organize_imports() *jdtls.organize_imports*

View file

@ -33,10 +33,12 @@ local M = {
--- Start the language server (if not started), and attach the current buffer.
---
---@param config table configuration. See |vim.lsp.start_client|
---@return integer? client_id
function M.start_or_attach(config)
return setup.start_or_attach(config)
---@param config table<string, any> configuration. See |vim.lsp.start_client|
---@param opts? jdtls.start.opts
---@param start_opts? lsp.StartOpts options passed to vim.lsp.start
---@return integer|nil client_id
function M.start_or_attach(config, opts, start_opts)
return setup.start_or_attach(config, opts, start_opts)
end

View file

@ -251,9 +251,13 @@ end
---@field dap? JdtSetupDapOpts
--- Start the language server (if not started), and attach the current buffer.
---
---@param config table<string, any> configuration. See |vim.lsp.start_client|
---@param opts? jdtls.start.opts
---@param start_opts? lsp.StartOpts options passed to vim.lsp.start
---@return integer? client_id
function M.start_or_attach(config, opts)
function M.start_or_attach(config, opts, start_opts)
opts = opts or {}
assert(config, 'config is required')
assert(
@ -316,7 +320,7 @@ function M.start_or_attach(config, opts)
}
})
maybe_implicit_save()
return vim.lsp.start(config)
return vim.lsp.start(config, start_opts)
end