summaryrefslogtreecommitdiffstats
path: root/src/channel.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2023-09-20 20:32:55 +0200
committerChristian Brabandt <cb@256bit.org>2023-09-20 20:32:55 +0200
commit78c5a5abc657f0173551157547213d8bbb033fd4 (patch)
treeef0de2fdfd99d81d9bf1167296f62f583d59796c /src/channel.c
parent87018255e3ad0f4dfa03e20318836d24af721caf (diff)
patch 9.0.1922: LSP server request message is misinterpreted as a response messagev9.0.1922
Problem: LSP server request message is misinterpreted as a response message Solution: Check that the message does not have the "message" field closes: #13133 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.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/channel.c b/src/channel.c
index cdb956e7cf..4326ca7c11 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -2927,9 +2927,16 @@ may_invoke_callback(channel_T *channel, ch_part_T part)
seq_nr = 0;
if (d != NULL)
{
- 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;
+ // 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;
+ }
}
argv[1] = *listtv;