mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-21 16:39:06 +02:00
fix(java): jdtls run with args (#4689)
## Description Makes run with args work for jdtls ## Related Issue(s) - Closes #4686 - Closes #4673
This commit is contained in:
parent
29dab35619
commit
0403e80a8e
1 changed files with 10 additions and 4 deletions
|
@ -1,11 +1,17 @@
|
||||||
---@param config {args?:string[]|fun():string[]?}
|
---@param config {type?:string, args?:string[]|fun():string[]?}
|
||||||
local function get_args(config)
|
local function get_args(config)
|
||||||
local args = type(config.args) == "function" and (config.args() or {}) or config.args or {}
|
local args = type(config.args) == "function" and (config.args() or {}) or config.args or {} --[[@as string[] | string ]]
|
||||||
|
local args_str = type(args) == "table" and table.concat(args, " ") or args --[[@as string]]
|
||||||
|
|
||||||
config = vim.deepcopy(config)
|
config = vim.deepcopy(config)
|
||||||
---@cast args string[]
|
---@cast args string[]
|
||||||
config.args = function()
|
config.args = function()
|
||||||
local new_args = vim.fn.input("Run with args: ", table.concat(args, " ")) --[[@as string]]
|
local new_args = vim.fn.expand(vim.fn.input("Run with args: ", args_str))
|
||||||
return vim.split(vim.fn.expand(new_args) --[[@as string]], " ")
|
if config.type and config.type == "java" then
|
||||||
|
---@diagnostic disable-next-line: return-type-mismatch
|
||||||
|
return new_args
|
||||||
|
end
|
||||||
|
return vim.split(new_args, " ")
|
||||||
end
|
end
|
||||||
return config
|
return config
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue