A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/neovim/neovim/commit/1dbf8675c71dc500ae7502085161cd56e311ccf6 below:

respect silent in error reporting · neovim/neovim@1dbf867 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+21

-14

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+21

-14

lines changed Original file line number Diff line number Diff line change

@@ -636,12 +636,24 @@ function vim.pretty_print(...)

636 636

return ...

637 637

end

638 638 639 -

function vim._cs_remote(rcid, args)

639 +

function vim._cs_remote(rcid, server_addr, connect_error, args)

640 +

local function connection_failure_errmsg(consequence)

641 +

local explanation

642 +

if server_addr == '' then

643 +

explanation = "No server specified with --server"

644 +

else

645 +

explanation = "Failed to connect to '" .. server_addr .. "'"

646 +

if connect_error ~= "" then

647 +

explanation = explanation .. ": " .. connect_error

648 +

end

649 +

end

650 +

return "E247: " .. explanation .. ". " .. consequence

651 +

end

652 + 640 653

local f_silent = false

641 654

local f_tab = false

642 655 643 656

local subcmd = string.sub(args[1],10)

644 - 645 657

if subcmd == 'tab' then

646 658

f_tab = true

647 659

elseif subcmd == 'silent' then

@@ -653,13 +665,13 @@ function vim._cs_remote(rcid, args)

653 665

f_silent = true

654 666

elseif subcmd == 'send' then

655 667

if rcid == 0 then

656 -

return { errmsg = 'E247: Remote server does not exist. Send failed.' }

668 +

return { errmsg = connection_failure_errmsg('Send failed.') }

657 669

end

658 670

vim.fn.rpcrequest(rcid, 'nvim_input', args[2])

659 671

return { should_exit = true, tabbed = false }

660 672

elseif subcmd == 'expr' then

661 673

if rcid == 0 then

662 -

return { errmsg = 'E247: Remote server does not exist. Send expression failed.' }

674 +

return { errmsg = connection_failure_errmsg('Send expression failed.') }

663 675

end

664 676

print(vim.fn.rpcrequest(rcid, 'nvim_eval', args[2]))

665 677

return { should_exit = true, tabbed = false }

@@ -669,7 +681,7 @@ function vim._cs_remote(rcid, args)

669 681 670 682

if rcid == 0 then

671 683

if not f_silent then

672 -

vim.cmd('echohl WarningMsg | echomsg "E247: Remote server does not exist. Editing locally" | echohl None')

684 +

vim.notify(connection_failure_errmsg("Editing locally"), vim.log.levels.WARN)

673 685

end

674 686

else

675 687

local command = {}

Original file line number Diff line number Diff line change

@@ -815,17 +815,10 @@ static void handle_remote_client(mparm_T *params, int remote_args,

815 815

rvobj.data.dictionary = (Dictionary)ARRAY_DICT_INIT;

816 816

rvobj.type = kObjectTypeDictionary;

817 817

CallbackReader on_data = CALLBACK_READER_INIT;

818 -

const char *error = NULL;

818 +

const char *connect_error = NULL;

819 819

uint64_t rc_id = 0;

820 820

if (server_addr != NULL) {

821 -

rc_id = channel_connect(false, server_addr, true, on_data, 50, &error);

822 -

}

823 -

if (error) {

824 -

mch_msg("Failed to connect to server ");

825 -

mch_msg(server_addr);

826 -

mch_msg("\nReason: ");

827 -

mch_msg(error);

828 -

mch_msg("Continuing with remote command in case we can execute locally\n");

821 +

rc_id = channel_connect(false, server_addr, true, on_data, 50, &connect_error);

829 822

}

830 823 831 824

int t_argc = remote_args;

@@ -839,6 +832,8 @@ static void handle_remote_client(mparm_T *params, int remote_args,

839 832

Error err = ERROR_INIT;

840 833

Array a = ARRAY_DICT_INIT;

841 834

ADD(a, INTEGER_OBJ((int)rc_id));

835 +

ADD(a, CSTR_TO_OBJ(server_addr));

836 +

ADD(a, CSTR_TO_OBJ(connect_error));

842 837

ADD(a, ARRAY_OBJ(args));

843 838

String s = cstr_to_string("return vim._cs_remote(...)");

844 839

Object o = nlua_exec(s, a, &err);

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