diff options
author | Magnus Groß <magnus@mggross.com> | 2023-08-27 00:49:51 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-08-27 11:11:22 +0200 |
commit | 8fbd9449e71f2ad93e594be575209a7424eb093e (patch) | |
tree | 4813e963e015ebaaa410c5426d48f606b1b555bd /src/json.c | |
parent | 0db1ea481528917e64ff5cd2e3a6f26e0271d5db (diff) |
patch 9.0.1790: Redundant LSP Content-Type headerv9.0.1790
Problem: The Content-Type header is an optional header that some LSP
servers struggle with and may crash when encountering it.
Solution: Drop the Content-Type header from all messages, because we use
the default value anyway.
Because pretty much all popular LSP clients (e.g. coc.nvim, VSCode) do
not send the Content-Type header, the LSP server ecosystem has developed
such that some LSP servers may even crash when encountering it.
To improve compatibility with these misbehaving LSP servers, we drop
this header as well.
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Magnus Groß <magnus@mggross.com>
Diffstat (limited to 'src/json.c')
-rw-r--r-- | src/json.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/json.c b/src/json.c index acf7ac57cf..e2a011309c 100644 --- a/src/json.c +++ b/src/json.c @@ -105,8 +105,7 @@ json_encode_lsp_msg(typval_T *val) ga_init2(&lspga, 1, 4000); // Header according to LSP specification. vim_snprintf((char *)IObuff, IOSIZE, - "Content-Length: %u\r\n" - "Content-Type: application/vscode-jsonrpc; charset=utf-8\r\n\r\n", + "Content-Length: %u\r\n\r\n", ga.ga_len - 1); ga_concat(&lspga, IObuff); ga_concat_len(&lspga, ga.ga_data, ga.ga_len); |