diff --git a/README.md b/README.md index d58b7341..b26cb8ab 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,7 @@ call LspOptionsSet(#{ \ customCompletionKinds: v:false, \ completionKinds: {}, \ filterCompletionDuplicates: v:false, + \ condensedCompletionMenu: v:false, \ }) ``` diff --git a/autoload/lsp/lspserver.vim b/autoload/lsp/lspserver.vim index 11e8d67c..562c8c4f 100644 --- a/autoload/lsp/lspserver.vim +++ b/autoload/lsp/lspserver.vim @@ -1014,7 +1014,7 @@ def FindLocations(lspserver: dict, peek: bool, method: string, args: dictempty() || reply.result->empty() - util.WarnMsg('No references found') + util.WarnMsg('No location found') return endif @@ -1026,7 +1026,7 @@ def FindLocations(lspserver: dict, peek: bool, method: string, args: dict 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 b g:LspFindLocations('ccls', false, "$ccls/inheritance", {}) + nmap B g:LspFindLocations('ccls', false, "$ccls/inheritance", {"levels": 3}) + # derived of up to 3 levels + nmap d g:LspFindLocations('ccls', false, "$ccls/inheritance", {"derived": v:true}) + nmap D g:LspFindLocations('ccls', false, "$ccls/inheritance", {"derived": v:true, "levels": 3}) + # caller + nmap c g:LspFindLocations('ccls', false, "$ccls/call") + # callee + nmap C g:LspFindLocations('ccls', false, "$ccls/call", {"callee": v:true}) + # member + nmap m g:LspFindLocations('ccls', false, "$ccls/member") + } + +============================================================================== +18. Multiple Language Servers for a buffer *lsp-multiple-servers* It's possible to run multiple language servers for a given buffer. @@ -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