]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Update options for the LSP symbols buffer
authorYegappan Lakshmanan <yegappan@yahoo.com>
Sun, 20 Dec 2020 06:41:52 +0000 (22:41 -0800)
committerYegappan Lakshmanan <yegappan@yahoo.com>
Sun, 20 Dec 2020 06:41:52 +0000 (22:41 -0800)
autoload/lsp.vim

index d85dad7e71e61a213b3ccd152171b8e7ef836240..6c926507bb36fbe09fecc77d32a91c414f0c12b7 100644 (file)
@@ -247,19 +247,21 @@ def LSPprocessDocSymbolReply(ftype: string, req: dict<any>, reply: dict<any>): v
 
   var fname: string = req.params.textDocument.uri[7:]
   for symbol in reply.result
-    symbolType = LSPSymbolKindToName(symbol.kind)
-    if !symbols->has_key(symbolType)
-      symbols[symbolType] = []
-    endif
-    var name: string = symbol.name
-    if symbol->has_key('containerName')
-      if symbol.containerName != ''
-        name ..= ' [' .. symbol.containerName .. ']'
+    if symbol->has_key('location')
+      symbolType = LSPSymbolKindToName(symbol.kind)
+      if !symbols->has_key(symbolType)
+        symbols[symbolType] = []
+      endif
+      var name: string = symbol.name
+      if symbol->has_key('containerName')
+        if symbol.containerName != ''
+          name ..= ' [' .. symbol.containerName .. ']'
+        endif
       endif
+      symbols[symbolType]->add({'name': name,
+                                'lnum': symbol.location.range.start.line + 1,
+                                'col': symbol.location.range.start.character + 1})
     endif
-    symbols[symbolType]->add({'name': name,
-                              'lnum': symbol.location.range.start.line + 1,
-                              'col': symbol.location.range.start.character + 1})
   endfor
 
   var wid: number = bufwinid('LSP-Symbols')
@@ -270,10 +272,12 @@ def LSPprocessDocSymbolReply(ftype: string, req: dict<any>, reply: dict<any>): v
   endif
 
   :setlocal modifiable
+  :setlocal noreadonly
   :silent! :%d _
   :setlocal buftype=nofile
-  :setlocal noswapfile
-  :setlocal nonumber fdc=0 nowrap winfixheight winfixwidth
+  :setlocal bufhidden=delete
+  :setlocal noswapfile nobuflisted
+  :setlocal nonumber norelativenumber fdc=0 nowrap winfixheight winfixwidth
   setline(1, ['# Language Server Symbols', '# ' .. fname])
   # First two lines in the buffer display comment information
   var lnumMap: list<dict<number>> = [{}, {}]