Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ call LspOptionsSet(#{
\ customCompletionKinds: v:false,
\ completionKinds: {},
\ filterCompletionDuplicates: v:false,
\ condensedCompletionMenu: v:false,
\ })
```

Expand Down
4 changes: 2 additions & 2 deletions autoload/lsp/lspserver.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ def FindLocations(lspserver: dict<any>, peek: bool, method: string, args: dict<a

# Result: Location[] | null
if reply->empty() || reply.result->empty()
util.WarnMsg('No references found')
util.WarnMsg('No location found')
return
endif

Expand All @@ -1026,7 +1026,7 @@ def FindLocations(lspserver: dict<any>, peek: bool, method: string, args: dict<a
})
endif

symbol.ShowLocations(lspserver, reply.result, peek, 'Symbol References')
symbol.ShowLocations(lspserver, reply.result, peek, 'Symbol Locations')
enddef

# process the 'textDocument/documentHighlight' reply from the LSP server
Expand Down
46 changes: 41 additions & 5 deletions doc/lsp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ CONTENTS *lsp-contents*
14. Custom Command Handlers .................. |lsp-custom-commands|
15. Custom LSP Completion Kinds .............. |lsp-custom-kinds|
16. Custom Popup Styles ...................... |lsp-custom-popup-styles|
17. Multiple Language Servers for a buffer ... |lsp-multiple-servers|
18. Language Servers Features ................ |lsp-features|
19. License .................................. |lsp-license|
17. Custom Locations Request ................. |lsp-custom-locations|
18. Multiple Language Servers for a buffer ... |lsp-multiple-servers|
19. Language Servers Features ................ |lsp-features|
20. License .................................. |lsp-license|

==============================================================================
1. Overview *lsp-overview*
Expand Down Expand Up @@ -1989,7 +1990,42 @@ popup-type |lsp-options|: >
For styling the completion menu please refer to |hl-pmenu|.

==============================================================================
17. Multiple Language Servers for a buffer *lsp-multiple-servers*
17. Custom Locations Request *lsp-custom-locations*

Language server may support non-standard locations request. To display the
locations of the symbol under cursor, you can use the
g:LspFindLocations(server_name, peek, method, args) function. "server_name" is
then "name" you pass in LspAddServer(). "peek" is a boolean value. If true, it
displays the list of locations in a popup menu, otherwise in a new locations
list. It behaves like |:LspPeekReferences| and |:LspShowReferences| .
For example: >

vim9script

g:LspAddServer([{
filetype: ["cpp"],
name: 'ccls',
path: '/usr/bin/ccls',
}])

autocmd Filetype cpp {
# x (xref)
# bases of up to 3 levels
nmap <buffer> <localleader>b <scriptcmd>g:LspFindLocations('ccls', false, "$ccls/inheritance", {})<cr>
nmap <buffer> <localleader>B <scriptcmd>g:LspFindLocations('ccls', false, "$ccls/inheritance", {"levels": 3})<cr>
# derived of up to 3 levels
nmap <buffer> <localleader>d <scriptcmd>g:LspFindLocations('ccls', false, "$ccls/inheritance", {"derived": v:true})<cr>
nmap <buffer> <localleader>D <scriptcmd>g:LspFindLocations('ccls', false, "$ccls/inheritance", {"derived": v:true, "levels": 3})<cr>
# caller
nmap <buffer> <localleader>c <scriptcmd>g:LspFindLocations('ccls', false, "$ccls/call")<cr>
# callee
nmap <buffer> <localleader>C <scriptcmd>g:LspFindLocations('ccls', false, "$ccls/call", {"callee": v:true})<cr>
# member
nmap <buffer> <localleader>m <scriptcmd>g:LspFindLocations('ccls', false, "$ccls/member")<cr>
}

==============================================================================
18. Multiple Language Servers for a buffer *lsp-multiple-servers*

It's possible to run multiple language servers for a given buffer.

Expand Down Expand Up @@ -2080,7 +2116,7 @@ everything else: >
])
<
==============================================================================
18. Language Server Features *lsp-features*
19. Language Server Features *lsp-features*

When using multiple language servers for a given file type, by providing the
configuration |lsp-cfg-features| it is possible to specify which language
Expand Down