@@ -22,10 +22,11 @@ CONTENTS *lsp-contents*
2222 12. Highlight Groups ......................... | lsp-highlight-groups |
2323 13. Debugging ................................ | lsp-debug |
2424 14. Custom Command Handlers .................. | lsp-custom-commands |
25- 15. Custom LSP Completion Kinds .............. | lsp-custom-kinds |
26- 16. Multiple Language Servers for a buffer ... | lsp-multiple-servers |
27- 17. Language Servers Features ................ | lsp-features |
28- 18. License .................................. | lsp-license |
25+ 15. Custom Locations Request ................. | lsp-custom-locations |
26+ 16. Custom LSP Completion Kinds .............. | lsp-custom-kinds |
27+ 17. Multiple Language Servers for a buffer ... | lsp-multiple-servers |
28+ 18. Language Servers Features ................ | lsp-features |
29+ 19. License .................................. | lsp-license |
2930
3031==============================================================================
31321. Overview *lsp-overview*
@@ -1796,7 +1797,42 @@ contains the LSP Command interface fields. Refer to the LSP specification for
17961797more information about the "Command" interface.
17971798
17981799==============================================================================
1799- 15. Custom LSP Completion Kinds *lsp-custom-kinds*
1800+ 15. Custom Locations Request *lsp-custom-locations*
1801+
1802+ Language server may support non-standard locations request. To display the
1803+ locations of the symbol under cursor, you can use the
1804+ g:LspFindLocations(server_name, peek, method, args) function. "server_name" is
1805+ then "name" you pass in LspAddServer(). "peek" is a boolean value. If true, it
1806+ displays the list of locations in a popup menu, otherwise in a new locations
1807+ list. It behaves like | :LspPeekReferences | and | :LspShowReferences | .
1808+ For example: >
1809+
1810+ vim9script
1811+
1812+ g:LspAddServer([{
1813+ filetype: ["cpp"],
1814+ name: 'ccls',
1815+ path: '/usr/bin/ccls',
1816+ }])
1817+
1818+ autocmd Filetype cpp {
1819+ # x (xref)
1820+ # bases of up to 3 levels
1821+ nmap <buffer> <localleader>b <scriptcmd>g:LspFindLocations('ccls', false, "$ccls/inheritance", {})<cr>
1822+ nmap <buffer> <localleader>B <scriptcmd>g:LspFindLocations('ccls', false, "$ccls/inheritance", {"levels": 3})<cr>
1823+ # derived of up to 3 levels
1824+ nmap <buffer> <localleader>d <scriptcmd>g:LspFindLocations('ccls', false, "$ccls/inheritance", {"derived": v:true})<cr>
1825+ nmap <buffer> <localleader>D <scriptcmd>g:LspFindLocations('ccls', false, "$ccls/inheritance", {"derived": v:true, "levels": 3})<cr>
1826+ # caller
1827+ nmap <buffer> <localleader>c <scriptcmd>g:LspFindLocations('ccls', false, "$ccls/call")<cr>
1828+ # callee
1829+ nmap <buffer> <localleader>C <scriptcmd>g:LspFindLocations('ccls', false, "$ccls/call", {"callee": v:true})<cr>
1830+ # member
1831+ nmap <buffer> <localleader>m <scriptcmd>g:LspFindLocations('ccls', false, "$ccls/member")<cr>
1832+ }
1833+
1834+ ==============================================================================
1835+ 16. Custom LSP Completion Kinds *lsp-custom-kinds*
18001836
18011837When a completion popup is triggered, the LSP client will use a default kind
18021838list to show in the completion "kind" section, to customize it, you need to
@@ -1854,7 +1890,7 @@ In the completion popup, will show something like this: >
18541890 | ... |
18551891<
18561892==============================================================================
1857- 16 . Multiple Language Servers for a buffer *lsp-multiple-servers*
1893+ 17 . Multiple Language Servers for a buffer *lsp-multiple-servers*
18581894
18591895It's possible to run multiple language servers for a given buffer.
18601896
@@ -1945,7 +1981,7 @@ everything else: >
19451981 ])
19461982<
19471983==============================================================================
1948- 17 . Language Server Features *lsp-features*
1984+ 18 . Language Server Features *lsp-features*
19491985
19501986When using multiple language servers for a given file type, by providing the
19511987configuration | lsp-cfg-features | it is possible to specify which language
0 commit comments