+37
-34
lines changedFilter options
+37
-34
lines changed Original file line number Diff line number Diff line change
@@ -83,7 +83,7 @@ You can not put options there!
83
83
84
84
85
85
==============================================================================
86
-
2. Missing functionality *clientserver-missing*
86
+
2. Missing functionality *E5600* *clientserver-missing*
87
87
88
88
Vim supports additional functionality in clientserver that's not yet
89
89
implemented in Nvim. In particular, none of the 'wait' variants are supported
Original file line number Diff line number Diff line change
@@ -638,56 +638,39 @@ end
638
638
639
639
function vim._cs_remote(rcid, args)
640
640
local f_silent = false
641
-
local f_wait = false
642
641
local f_tab = false
643
642
644
643
local subcmd = string.sub(args[1],10)
645
644
646
-
if subcmd == '' then
647
-
-- no flags to set
648
-
elseif subcmd == 'tab' then
645
+
if subcmd == 'tab' then
649
646
f_tab = true
650
647
elseif subcmd == 'silent' then
651
648
f_silent = true
652
-
elseif subcmd == 'wait' then
653
-
f_wait = true
654
-
elseif subcmd == 'wait-silent' then
655
-
f_wait = true
656
-
f_silent = true
657
-
elseif subcmd == 'tab-wait' then
658
-
f_tab = true
659
-
f_wait = true
649
+
elseif subcmd == 'wait' or subcmd == 'wait-silent' or subcmd == 'tab-wait' or subcmd == 'tab-wait-silent' then
650
+
return { errmsg = 'E5600: Wait commands not yet implemented in nvim' }
660
651
elseif subcmd == 'tab-silent' then
661
652
f_tab = true
662
653
f_silent = true
663
-
elseif subcmd == 'tab-wait-silent' then
664
-
f_tab = true
665
-
f_wait = true
666
-
f_silent = true
667
654
elseif subcmd == 'send' then
668
655
if rcid == 0 then
669
-
vim.cmd('echoerr "E247: Remote server does not exist. Send failed."')
670
-
return
656
+
return { errmsg = 'E247: Remote server does not exist. Send failed.' }
671
657
end
672
658
vim.fn.rpcrequest(rcid, 'nvim_input', args[2])
673
659
return { should_exit = true, tabbed = false }
674
660
elseif subcmd == 'expr' then
675
661
if rcid == 0 then
676
-
vim.cmd('echoerr "E247: Remote server does not exist. Send expression failed."')
677
-
return
662
+
return { errmsg = 'E247: Remote server does not exist. Send expression failed.' }
678
663
end
679
-
vim.fn.rpcrequest(rcid, 'nvim_eval', args[2])
664
+
print(vim.fn.rpcrequest(rcid, 'nvim_eval', args[2]))
680
665
return { should_exit = true, tabbed = false }
681
-
else
682
-
vim.cmd('echoerr "Unknown option argument: ' .. args[1] .. '"')
683
-
return
666
+
elseif subcmd ~= '' then
667
+
return { errmsg='Unknown option argument: ' .. args[1] }
684
668
end
685
669
686
670
if rcid == 0 then
687
671
if not f_silent then
688
672
vim.cmd('echohl WarningMsg | echomsg "E247: Remote server does not exist. Editing locally" | echohl None')
689
673
end
690
-
should_exit = false
691
674
else
692
675
local command = {}
693
676
if f_tab then table.insert(command, 'tab') end
Original file line number Diff line number Diff line change
@@ -816,8 +816,10 @@ static void handle_remote_client(mparm_T *params, int remote_args,
816
816
rvobj.type = kObjectTypeDictionary;
817
817
CallbackReader on_data = CALLBACK_READER_INIT;
818
818
const char *error = NULL;
819
-
uint64_t rc_id = server_addr == NULL ? 0 : channel_connect(false,
820
-
server_addr, true, on_data, 50, &error);
819
+
uint64_t rc_id = 0;
820
+
if (server_addr != NULL) {
821
+
rc_id = channel_connect(false, server_addr, true, on_data, 50, &error);
822
+
}
821
823
822
824
Boolean should_exit = true;
823
825
Boolean tabbed;
@@ -848,17 +850,33 @@ static void handle_remote_client(mparm_T *params, int remote_args,
848
850
rvobj.data.dictionary = o.data.dictionary;
849
851
} else {
850
852
mch_errmsg("vim._cs_remote returned unexpected value\n");
851
-
os_exit(3);
853
+
os_exit(2);
852
854
}
853
855
854
856
for (size_t i = 0; i < rvobj.data.dictionary.size ; i++) {
855
-
if (strcmp(rvobj.data.dictionary.items[i].key.data, "tabbed") == 0) {
856
-
// should we check items[i].value.type here?
857
+
if (strcmp(rvobj.data.dictionary.items[i].key.data, "errmsg") == 0) {
858
+
if (rvobj.data.dictionary.items[i].value.type != kObjectTypeString) {
859
+
mch_errmsg("vim._cs_remote returned an unexpected type for 'errmsg'\n");
860
+
os_exit(2);
861
+
}
862
+
mch_errmsg(rvobj.data.dictionary.items[i].value.data.string.data);
863
+
mch_errmsg("\n");
864
+
os_exit(2);
865
+
} else if (strcmp(rvobj.data.dictionary.items[i].key.data, "tabbed") == 0) {
866
+
if (rvobj.data.dictionary.items[i].value.type != kObjectTypeBoolean) {
867
+
mch_errmsg("vim._cs_remote returned an unexpected type for 'tabbed'\n");
868
+
os_exit(2);
869
+
}
857
870
tabbed = rvobj.data.dictionary.items[i].value.data.boolean;
858
871
} else if (strcmp(rvobj.data.dictionary.items[i].key.data, "should_exit") == 0) {
872
+
if (rvobj.data.dictionary.items[i].value.type != kObjectTypeBoolean) {
873
+
mch_errmsg("vim._cs_remote returned an unexpected type for 'should_exit'\n");
874
+
os_exit(2);
875
+
}
859
876
should_exit = rvobj.data.dictionary.items[i].value.data.boolean;
860
877
}
861
878
}
879
+
api_free_object(o);
862
880
863
881
if (should_exit) {
864
882
os_exit(0);
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@ local insert = helpers.insert
9
9
local meths = helpers.meths
10
10
local new_argv = helpers.new_argv
11
11
local neq = helpers.neq
12
-
local run = helpers.run
13
12
local set_session = helpers.set_session
14
13
local spawn = helpers.spawn
15
14
local tmpname = helpers.tmpname
@@ -38,7 +37,7 @@ describe('Remote', function()
38
37
server:close()
39
38
end)
40
39
41
-
function run_remote(...)
40
+
local function run_remote(...)
42
41
set_session(server)
43
42
local addr = funcs.serverlist()[1]
44
43
local client_argv = new_argv({args={'--server', addr, ...}})
@@ -121,7 +120,7 @@ describe('Remote', function()
121
120
-- to wait for the remote instance to exit and calling jobwait blocks
122
121
-- the event loop. If the server event loop is blocked, it can't process
123
122
-- our incoming --remote calls.
124
-
local client_starter = clear()
123
+
clear()
125
124
local bogus_job_id = funcs.jobstart(bogus_argv)
126
125
eq({2}, funcs.jobwait({bogus_job_id}))
127
126
end
@@ -136,5 +135,8 @@ describe('Remote', function()
136
135
it('expr without server', function()
137
136
run_and_check_exit_code('--remote-expr', 'setline(1, "Yo")')
138
137
end)
138
+
it('wait subcommand', function()
139
+
run_and_check_exit_code('--remote-wait', fname)
140
+
end)
139
141
end)
140
142
end)
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4