]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
fix description and missing code in ShowCompletionDocumentation()
authorOleksiy Hryshchenko <greeschenko@gmail.com>
Tue, 11 Apr 2023 14:04:12 +0000 (17:04 +0300)
committerOleksiy Hryshchenko <greeschenko@gmail.com>
Tue, 11 Apr 2023 14:04:12 +0000 (17:04 +0300)
autoload/lsp/completion.vim

index d07cda9291d35d89df305e7e30610c80bbf06ab1..6e805a59f424c37844dc0e4d5596cf22ec9fc22b 100644 (file)
@@ -248,7 +248,7 @@ export def CompletionReply(lspserver: dict<any>, cItems: any)
   endif
 enddef
 
-# process the completion documentation without LSP server request
+# process the completion documentation
 def ShowCompletionDocumentation(cItem: any)
   if cItem->empty() || cItem->type() != v:t_dict
     return
@@ -268,6 +268,13 @@ def ShowCompletionDocumentation(cItem: any)
   var infoText: list<string>
   var infoKind: string
 
+  if cItem->has_key('detail') && !cItem.detail->empty()
+    # 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(cItem.detail->split("\n"))
+  endif
+
   if cItem->has_key('documentation')
     if !infoText->empty()
       infoText->extend(['- - -'])