feat: lsp type definitions (#1224)
This commit is contained in:
25
README.md
25
README.md
@@ -446,18 +446,19 @@ Built-in functions. Ready to be bound to any key you like. :smile:
|
|||||||
|
|
||||||
### Neovim LSP Pickers
|
### Neovim LSP Pickers
|
||||||
|
|
||||||
| Functions | Description |
|
| Functions | Description |
|
||||||
|---------------------------------------------|-------------------------------------------------------------------------------------------------------------------|
|
|---------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `builtin.lsp_references` | Lists LSP references for word under the cursor |
|
| `builtin.lsp_references` | Lists LSP references for word under the cursor |
|
||||||
| `builtin.lsp_document_symbols` | Lists LSP document symbols in the current buffer |
|
| `builtin.lsp_document_symbols` | Lists LSP document symbols in the current buffer |
|
||||||
| `builtin.lsp_workspace_symbols` | Lists LSP document symbols in the current workspace |
|
| `builtin.lsp_workspace_symbols` | Lists LSP document symbols in the current workspace |
|
||||||
| `builtin.lsp_dynamic_workspace_symbols` | Dynamically Lists LSP for all workspace symbols |
|
| `builtin.lsp_dynamic_workspace_symbols` | Dynamically Lists LSP for all workspace symbols |
|
||||||
| `builtin.lsp_code_actions` | Lists any LSP actions for the word under the cursor, that can be triggered with `<cr>` |
|
| `builtin.lsp_code_actions` | Lists any LSP actions for the word under the cursor, that can be triggered with `<cr>` |
|
||||||
| `builtin.lsp_range_code_actions` | Lists any LSP actions for a given range, that can be triggered with `<cr>` |
|
| `builtin.lsp_range_code_actions` | Lists any LSP actions for a given range, that can be triggered with `<cr>` |
|
||||||
| `builtin.lsp_document_diagnostics` | Lists LSP diagnostics for the current buffer |
|
| `builtin.lsp_document_diagnostics` | Lists LSP diagnostics for the current buffer |
|
||||||
| `builtin.lsp_workspace_diagnostics` | Lists LSP diagnostics for the current workspace if supported, otherwise searches in all open buffers |
|
| `builtin.lsp_workspace_diagnostics` | Lists LSP diagnostics for the current workspace if supported, otherwise searches in all open buffers |
|
||||||
| `builtin.lsp_implementations` | Goto the implementation of the word under the cursor if there's only one, otherwise show all options in Telescope |
|
| `builtin.lsp_implementations` | Goto the implementation of the word under the cursor if there's only one, otherwise show all options in Telescope |
|
||||||
| `builtin.lsp_definitions` | Goto the definition of the word under the cursor, if there's only one, otherwise show all options in Telescope |
|
| `builtin.lsp_definitions` | Goto the definition of the word under the cursor, if there's only one, otherwise show all options in Telescope |
|
||||||
|
| `builtin.lsp_type_definitions` | Goto the definition of the type of the word under the cursor, if there's only one, otherwise show all options in Telescope|
|
||||||
|
|
||||||
#### Pre-filtering option for LSP pickers
|
#### Pre-filtering option for LSP pickers
|
||||||
|
|
||||||
|
|||||||
@@ -905,6 +905,18 @@ builtin.lsp_definitions({opts}) *builtin.lsp_definitions()*
|
|||||||
values: "tab", "split", "vsplit", "never"
|
values: "tab", "split", "vsplit", "never"
|
||||||
|
|
||||||
|
|
||||||
|
builtin.lsp_type_definitions({opts}) *builtin.lsp_type_definitions()*
|
||||||
|
Goto the definition of the type of the word under the cursor, if there's
|
||||||
|
only one, otherwise show all options in Telescope
|
||||||
|
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{opts} (table) options to pass to the picker
|
||||||
|
|
||||||
|
Fields: ~
|
||||||
|
{jump_type} (string) how to goto definition if there is only one,
|
||||||
|
values: "tab", "split", "vsplit", "never"
|
||||||
|
|
||||||
builtin.lsp_implementations({opts}) *builtin.lsp_implementations()*
|
builtin.lsp_implementations({opts}) *builtin.lsp_implementations()*
|
||||||
Goto the implementation of the word under the cursor if there's only one,
|
Goto the implementation of the word under the cursor if there's only one,
|
||||||
otherwise show all options in Telescope
|
otherwise show all options in Telescope
|
||||||
|
|||||||
@@ -355,6 +355,12 @@ builtin.lsp_references = require_on_exported_call("telescope.builtin.lsp").refer
|
|||||||
---@field jump_type string: how to goto definition if there is only one, values: "tab", "split", "vsplit", "never"
|
---@field jump_type string: how to goto definition if there is only one, values: "tab", "split", "vsplit", "never"
|
||||||
builtin.lsp_definitions = require_on_exported_call("telescope.builtin.lsp").definitions
|
builtin.lsp_definitions = require_on_exported_call("telescope.builtin.lsp").definitions
|
||||||
|
|
||||||
|
--- Goto the definition of the type of the word under the cursor, if there's only one,
|
||||||
|
--- otherwise show all options in Telescope
|
||||||
|
---@param opts table: options to pass to the picker
|
||||||
|
---@field jump_type string: how to goto definition if there is only one, values: "tab", "split", "vsplit", "never"
|
||||||
|
builtin.lsp_type_definitions = require("telescope.builtin.lsp").type_definitions
|
||||||
|
|
||||||
--- Goto the implementation of the word under the cursor if there's only one, otherwise show all options in Telescope
|
--- Goto the implementation of the word under the cursor if there's only one, otherwise show all options in Telescope
|
||||||
---@param opts table: options to pass to the picker
|
---@param opts table: options to pass to the picker
|
||||||
---@field jump_type string: how to goto implementation if there is only one, values: "tab", "split", "vsplit", "never"
|
---@field jump_type string: how to goto implementation if there is only one, values: "tab", "split", "vsplit", "never"
|
||||||
|
|||||||
@@ -95,6 +95,10 @@ lsp.definitions = function(opts)
|
|||||||
return list_or_jump("textDocument/definition", "LSP Definitions", opts)
|
return list_or_jump("textDocument/definition", "LSP Definitions", opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
lsp.type_definitions = function(opts)
|
||||||
|
return list_or_jump("textDocument/typeDefinition", "LSP Type Definitions", opts)
|
||||||
|
end
|
||||||
|
|
||||||
lsp.implementations = function(opts)
|
lsp.implementations = function(opts)
|
||||||
return list_or_jump("textDocument/implementation", "LSP Implementations", opts)
|
return list_or_jump("textDocument/implementation", "LSP Implementations", opts)
|
||||||
end
|
end
|
||||||
@@ -403,6 +407,7 @@ local feature_map = {
|
|||||||
["document_symbols"] = "document_symbol",
|
["document_symbols"] = "document_symbol",
|
||||||
["references"] = "find_references",
|
["references"] = "find_references",
|
||||||
["definitions"] = "goto_definition",
|
["definitions"] = "goto_definition",
|
||||||
|
["type_definitions"] = "type_definition",
|
||||||
["implementations"] = "implementation",
|
["implementations"] = "implementation",
|
||||||
["workspace_symbols"] = "workspace_symbol",
|
["workspace_symbols"] = "workspace_symbol",
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user