summaryrefslogtreecommitdiffstats
path: root/src/channel.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2023-09-21 16:36:28 +0200
committerChristian Brabandt <cb@256bit.org>2023-09-21 16:36:28 +0200
commit1926ae41845c3b6e2045b29225365c8a2e4eb1da (patch)
tree4244ed2884cc22c4cbc7383c91f4d3fc3283ee46 /src/channel.c
parentdb54e989b5cff3cc6442dfc500e3962cc1c0b6d0 (diff)
patch 9.0.1924: LSP server message still wrongly handled (after 9.0.1922)v9.0.1924
Problem: LSP server message still wrongly handled (after 9.0.1922) Solution: Handle 'method' messages properly, don't discard them, add tests. closes: #13141 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/channel.c')
-rw-r--r--src/channel.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/channel.c b/src/channel.c
index 4326ca7c11..1de376884a 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -2466,6 +2466,12 @@ channel_get_json(
d = item->jq_value->vval.v_dict;
if (d == NULL)
goto nextitem;
+ // When looking for a response message from the LSP server,
+ // ignore new LSP request and notification messages.  LSP
+ // request and notification messages have the "method" field in
+ // the header and the response messages do not have this field.
+ if (dict_has_key(d, "method"))
+ goto nextitem;
di = dict_find(d, (char_u *)"id", -1);
if (di == NULL)
goto nextitem;
@@ -2927,16 +2933,9 @@ may_invoke_callback(channel_T *channel, ch_part_T part)
seq_nr = 0;
if (d != NULL)
{
- // When looking for a response message from the LSP server,
- // ignore new LSP request and notification messages. LSP
- // request and notification messages have the "method" field in
- // the header and the response messages do not have this field.
- if (!dict_has_key(d, "method"))
- {
- di = dict_find(d, (char_u *)"id", -1);
- if (di != NULL && di->di_tv.v_type == VAR_NUMBER)
- seq_nr = di->di_tv.vval.v_number;
- }
+ di = dict_find(d, (char_u *)"id", -1);
+ if (di != NULL && di->di_tv.v_type == VAR_NUMBER)
+ seq_nr = di->di_tv.vval.v_number;
}
argv[1] = *listtv;