Skip to content

Commit

Permalink
Merge branch 'master' into fix/altbuf
Browse files Browse the repository at this point in the history
  • Loading branch information
fengwk committed Nov 14, 2023
2 parents f652141 + 503a399 commit 81e0111
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
11 changes: 8 additions & 3 deletions doc/jdtls.txt
Original file line number Diff line number Diff line change
@@ -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*
Expand Down
14 changes: 8 additions & 6 deletions lua/jdtls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -483,15 +485,15 @@ local function change_signature(bufnr, command, code_action_params)
if vim.startswith(line, "---") then
break
elseif expect_param_next and vim.startswith(line, "- ") then
local matches = { line:match("%- ((%d+):) (%w+) (%w+)") }
local matches = { line:match("%- ((%d+):) ([^ ]+) (%w+)") }
if next(matches) then
table.insert(parameters, {
name = matches[4],
originalIndex = assert(tonumber(matches[2]), "Parameter must have originalIndex"),
type = matches[3],
})
else
matches = { line:match("%- (%w+) (%w+) ?(%w*)") }
matches = { line:match("%- (%w+) ([^ ]+) ?(%w*)") }
if next(matches) then
table.insert(parameters, {
type = matches[1],
Expand Down
8 changes: 6 additions & 2 deletions lua/jdtls/setup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,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(
Expand Down Expand Up @@ -329,7 +333,7 @@ function M.start_or_attach(config, opts)
}
})
maybe_implicit_save()
return vim.lsp.start(config)
return vim.lsp.start(config, start_opts)
end


Expand Down

0 comments on commit 81e0111

Please sign in to comment.