runtime: fix remote plugin command fails at some case

fixes #12410
This commit is contained in:
kuuote 2020-05-31 20:21:58 +09:00
parent 4b87248285
commit 7124c0e5ac
2 changed files with 16 additions and 1 deletions

View File

@ -24,7 +24,7 @@ function! remote#define#CommandOnHost(host, method, sync, name, opts)
endif
if has_key(a:opts, 'nargs')
call add(forward_args, ' <args>')
call add(forward_args, ' " . <q-args> . "')
endif
exe s:GetCommandPrefix(a:name, a:opts)

View File

@ -89,6 +89,21 @@ local function command_specs_for(fn, sync, first_arg_factory, init)
runx(sync, handler, on_setup)
end)
it('with nargs/double-quote', function()
call(fn, args..', {"nargs": "*"}')
local function on_setup()
command('RpcCommand "arg"')
end
local function handler(method, arguments)
eq('test-handler', method)
eq({'"arg"'}, arguments[1])
return ''
end
runx(sync, handler, on_setup)
end)
it('with range', function()
call(fn,args..', {"range": ""}')
local function on_setup()