1
0
forked from aniani/vim

patch 9.0.0977: it is not easy to see what client-server commands are doing

Problem:    It is not easy to see what client-server commands are doing.
Solution:   Add channel log messages if ch_log() is available.  Move the
            channel logging and make it available with the +eval feature.
This commit is contained in:
Bram Moolenaar
2022-11-30 18:12:19 +00:00
parent a87749e3ea
commit 4c5678ff0c
27 changed files with 341 additions and 257 deletions

View File

@@ -388,11 +388,12 @@ serverSendToVim(
if (name == NULL || *name == NUL)
name = (char_u *)"GVIM"; // use a default name
if (commProperty == None && dpy != NULL)
{
if (SendInit(dpy) < 0)
return -1;
}
if (commProperty == None && dpy != NULL && SendInit(dpy) < 0)
return -1;
#if defined(FEAT_EVAL)
ch_log(NULL, "serverSendToVim(%s, %s)", name, cmd);
#endif
// Execute locally if no display or target is ourselves
if (dpy == NULL || (serverName != NULL && STRICMP(name, serverName) == 0))
@@ -494,6 +495,11 @@ serverSendToVim(
break;
}
}
#if defined(FEAT_EVAL)
ch_log(NULL, "serverSendToVim() result: %s",
pending.result == NULL ? "NULL" : (char *)pending.result);
#endif
if (result != NULL)
*result = pending.result;
else
@@ -1221,6 +1227,10 @@ server_parse_message(
int code;
char_u *tofree;
#if defined(FEAT_EVAL)
ch_log(NULL, "server_parse_message() numItems: %ld", numItems);
#endif
/*
* Several commands and results could arrive in the property at
* one time; each iteration through the outer loop handles a
@@ -1240,7 +1250,7 @@ server_parse_message(
continue;
}
if ((*p == 'c' || *p == 'k') && (p[1] == 0))
if ((*p == 'c' || *p == 'k') && p[1] == 0)
{
Window resWindow;
char_u *name, *script, *serial, *end;
@@ -1261,6 +1271,9 @@ server_parse_message(
enc = NULL;
while ((long_u)(p - propInfo) < numItems && *p == '-')
{
#if defined(FEAT_EVAL)
ch_log(NULL, "server_parse_message() item: %c, %s", p[-2], p);
#endif
switch (p[1])
{
case 'r':
@@ -1326,7 +1339,8 @@ server_parse_message(
ga_concat(&reply, res);
else
{
ga_concat(&reply, (char_u *)_(e_invalid_expression_received));
ga_concat(&reply,
(char_u *)_(e_invalid_expression_received));
ga_append(&reply, 0);
ga_concat(&reply, (char_u *)"-c 1");
}