]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Fix get hover kind from the first test
authorIndelog <maxime@indelog.fr>
Sun, 21 Nov 2021 10:40:37 +0000 (11:40 +0100)
committerIndelog <maxime@indelog.fr>
Sun, 21 Nov 2021 10:46:28 +0000 (11:46 +0100)
autoload/handlers.vim

index 709f7552fec78e2d343a9e6b4b2218c16924652e..23264feb21a20a0f02fbf8c29bbedde2d2ac4bc8 100644 (file)
@@ -293,14 +293,17 @@ def s:processHoverReply(lspserver: dict<any>, req: dict<any>, reply: dict<any>):
   endif
 
   var hoverText: list<string>
+  var hoverKind: string
 
   if reply.result.contents->type() == v:t_dict
     if reply.result.contents->has_key('kind')
       # MarkupContent
       if reply.result.contents.kind == 'plaintext'
         hoverText = reply.result.contents.value->split("\n")
+        hoverKind = 'text'
       elseif reply.result.contents.kind == 'markdown'
         hoverText = reply.result.contents.value->split("\n")
+        hoverKind = 'markdown'
       else
         ErrMsg('Error: Unsupported hover contents type (' .. reply.result.contents.kind .. ')')
         return
@@ -335,7 +338,7 @@ def s:processHoverReply(lspserver: dict<any>, req: dict<any>, reply: dict<any>):
     wincmd P
     setlocal buftype=nofile
     setlocal bufhidden=delete
-    exe 'setlocal ft=' .. reply.result.contents.kind
+    exe 'setlocal ft=' .. hoverKind
     deletebufline(bufnr(), 1, '$')
     append(0, hoverText)
     cursor(1, 1)