Allow range parameters on command parser (#1123)
This commit is contained in:
@@ -256,7 +256,7 @@ lsp.code_actions = function(opts)
|
|||||||
end
|
end
|
||||||
|
|
||||||
lsp.range_code_actions = function(opts)
|
lsp.range_code_actions = function(opts)
|
||||||
opts.params = vim.lsp.util.make_given_range_params()
|
opts.params = vim.lsp.util.make_given_range_params({ opts.start_line, 1 }, { opts.end_line, 1 })
|
||||||
lsp.code_actions(opts)
|
lsp.code_actions(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ function command.register_keyword(keyword)
|
|||||||
split_keywords[keyword] = true
|
split_keywords[keyword] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
function command.load_command(cmd, ...)
|
function command.load_command(start_line, end_line, count, cmd, ...)
|
||||||
local args = { ... }
|
local args = { ... }
|
||||||
if cmd == nil then
|
if cmd == nil then
|
||||||
run_command { cmd = "builtin" }
|
run_command { cmd = "builtin" }
|
||||||
@@ -211,7 +211,11 @@ function command.load_command(cmd, ...)
|
|||||||
|
|
||||||
local user_opts = {}
|
local user_opts = {}
|
||||||
user_opts["cmd"] = cmd
|
user_opts["cmd"] = cmd
|
||||||
user_opts.opts = {}
|
user_opts.opts = {
|
||||||
|
start_line = start_line,
|
||||||
|
end_line = end_line,
|
||||||
|
count = count,
|
||||||
|
}
|
||||||
|
|
||||||
for _, arg in ipairs(args) do
|
for _, arg in ipairs(args) do
|
||||||
if arg:find("=", 1) == nil then
|
if arg:find("=", 1) == nil then
|
||||||
|
|||||||
@@ -111,4 +111,4 @@ function! s:telescope_complete(arg,line,pos)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Telescope Commands with complete
|
" Telescope Commands with complete
|
||||||
command! -nargs=* -complete=custom,s:telescope_complete Telescope lua require('telescope.command').load_command(<f-args>)
|
command! -nargs=* -range -complete=custom,s:telescope_complete Telescope lua require('telescope.command').load_command(<line1>, <line2>, <count>, <f-args>)
|
||||||
|
|||||||
Reference in New Issue
Block a user