endif
enddef
-# Display the symbol in file 'fname' at 'location' in a popup window.
-def PeekSymbolLocation(lspserver: dict<any>, fname: string,
- location: dict<any>)
+# Display the file specified by LSP 'location' in a popup window and highlight
+# the range in 'location'.
+def PeekSymbolLocation(lspserver: dict<any>, location: dict<any>)
+ var fname = util.LspUriToFile(location.uri)
var bnum = fname->bufadd()
if bnum == 0
# Failed to create or find a buffer
# symbol.
export def GotoSymbol(lspserver: dict<any>, location: dict<any>,
peekSymbol: bool, cmdmods: string)
- var fname = util.LspUriToFile(location.uri)
if peekSymbol
- PeekSymbolLocation(lspserver, fname, location)
+ PeekSymbolLocation(lspserver, location)
else
# Save the current cursor location in the tag stack.
util.PushCursorToTagStack()
- util.JumpToLspLocation(fname, location, cmdmods)
+ util.JumpToLspLocation(location, cmdmods)
endif
enddef
return
endif
- var item = typeUriMap[selIdx - 1]
- var fname = util.LspUriToFile(item.uri)
# Save the current cursor location in the tag stack.
util.PushCursorToTagStack()
- util.JumpToLspLocation(fname, item, '')
+ util.JumpToLspLocation(typeUriMap[selIdx - 1], '')
enddef
# Show the super or sub type hierarchy items 'types' as a tree in a popup window
}]}, 't')
enddef
-# Jump to the LSP 'location' in file 'fname'. The user specified
-# window command modifiers (e.g. topleft) are in 'cmdmods'.
-export def JumpToLspLocation(fname: string, location: dict<any>,
- cmdmods: string)
+# Jump to the LSP 'location'. The 'location' contains the file name, line
+# number and character number. The user specified window command modifiers
+# (e.g. topleft) are in 'cmdmods'.
+export def JumpToLspLocation(location: dict<any>, cmdmods: string)
+ var fname = LspUriToFile(location.uri)
+
# jump to the file and line containing the symbol
if cmdmods == ''
var bnr: number = fname->bufnr()
*:LspSuperTypeHierarchy*
:LspSuperTypeHierarchy Show the super type hierarchy for the symbol under the
cursor in a popup window. The file containing the
- type is shown in another popup window. You can jump
- to the location where a type is defined by browsing the
- popup menu and selecting an entry.
+ type is shown in another popup window. As the current
+ entry in the type hierarchy popup menu changes, the
+ file popup window is updated to show the location
+ where the type is defined. You can jump to the
+ location where a type is defined by selecting the
+ entry in the popup menu.
+
+ Note that the type hierarchy support is based on the
+ protocol supported by clangd. This is different from
+ the one specified in the 3.17 of the LSP standard.
*:LspSubTypeHierarchy*
:LspSubTypeHierarchy Show the sub type hierarchy for the symbol under the