Mercurial > vim
diff src/if_xcmdsrv.c @ 31287:fa309d9af73c v9.0.0977
patch 9.0.0977: it is not easy to see what client-server commands are doing
Commit: https://github.com/vim/vim/commit/4c5678ff0c376661d4a8183a5a074a1203413b9d
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Nov 30 18:12:19 2022 +0000
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 30 Nov 2022 19:15:10 +0100 |
parents | 58fb880f3607 |
children | 27c9212d10aa |
line wrap: on
line diff
--- a/src/if_xcmdsrv.c +++ b/src/if_xcmdsrv.c @@ -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"); }