Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gbrlsnchs/telescope-lsp-handlers.nvim
https://github.com/gbrlsnchs/telescope-lsp-handlers.nvim
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/gbrlsnchs/telescope-lsp-handlers.nvim
- Owner: gbrlsnchs
- License: mit
- Created: 2021-03-19T18:38:54.000Z (over 3 years ago)
- Default Branch: trunk
- Last Pushed: 2023-03-04T18:47:51.000Z (over 1 year ago)
- Last Synced: 2024-08-02T13:34:18.832Z (3 months ago)
- Language: Lua
- Size: 14.6 KB
- Stars: 82
- Watchers: 3
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# telescope-lsp-handlers.nvim
## What
An extension for Telescope that registers handlers for
- `textDocument/declaration`
- `textDocument/definition`
- `textDocument/implementation`
- `textDocument/typeDefinition`
- `textDocument/references`
- `textDocument/documentSymbol`
- `workspace/symbol`
- `callHierarchy/incomingCalls`
- `callHierarchy/outgoingCalls`
- `textDocument/codeAction`## Why
1. I wanted to learn how to extend Telescope
2. I wanted to learn how to extend Neovim's built-in LSP handlers
3. I wanted to use `vim.lsp.buf.*` commands instead of `Telescope lsp_*` ones so I wouldn't need to
rely on Telescope replicating utility functions that are already part of Neovim's built-in LSP
4. Telescope's built-in LSP functions do not push items to the tagstack when picked manually, these
handlers do## How
Install this plugin with your favorite package manager and then load it with Telescope:
```lua
telescope.load_extension('lsp_handlers')
```Then proceed to use the built-in API for supported requests.
### Customization
It is possible to customize handlers in Telescope's setup phase. The following configuration is the
default one:
```lua
telescope.setup({
extensions = {
lsp_handlers = {
disable = {},
location = {
telescope = {},
no_results_message = 'No references found',
},
symbol = {
telescope = {},
no_results_message = 'No symbols found',
},
call_hierarchy = {
telescope = {},
no_results_message = 'No calls found',
},
code_action = {
telescope = {},
no_results_message = 'No code actions available',
prefix = '',
},
},
}
})
```I personally like to have the following settings, which gives me a cute dropdown for code actions:
```lua
telescope.setup({
extensions = {
lsp_handlers = {
code_action = {
telescope = require('telescope.themes').get_dropdown({}),
},
},
},
}
```#### Disabling specific handlers
```lua
telescope.setup({
extensions = {
lsp_handlers = {
disable = {
['textDocument/codeAction'] = true,
},
},
},
}
```