From ba7de7a82c5fcfdcb763e2df4ed257a4522c51aa Mon Sep 17 00:00:00 2001 From: D4yvid Date: Wed, 26 Oct 2022 13:51:58 -0300 Subject: [PATCH] Fix new lines in completion popup and in the completion detail popup --- autoload/lsp/handlers.vim | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/autoload/lsp/handlers.vim b/autoload/lsp/handlers.vim index 5ac541f..3215276 100644 --- a/autoload/lsp/handlers.vim +++ b/autoload/lsp/handlers.vim @@ -124,7 +124,12 @@ def ProcessCompletionReply(lspserver: dict, req: dict, reply: dicthas_key('detail') - d.menu = item.detail + # Solve a issue where if a server send a detail field + # with a "\n", on the menu will be everything joined with + # a "^@" separating it. (example: clangd) + var splitted_detail = split(item.detail, "\n") + + d.menu = splitted_detail[0] endif if item->has_key('documentation') if item.documentation->type() == v:t_string && item.documentation != '' @@ -209,7 +214,10 @@ def ProcessResolveReply(lspserver: dict, req: dict, reply: dict): var infoKind: string if reply.result->has_key('detail') - infoText->extend([reply.result.detail]) + # Solve a issue where if a server send the detail field with "\n", + # on the completion popup, everything will be joined with "^@" + # (example: typescript-language-server) + infoText->extend(split(reply.result.detail, "\n")) endif if reply.result->has_key('documentation') -- 2.48.1