19 lines
535 B
Lua
19 lines
535 B
Lua
|
-- extensions for lsp functionality
|
||
|
|
||
|
local function preview_location_callback(_, method, result)
|
||
|
if result == nil or vim.tbl_isempty(result) then
|
||
|
vim.lsp.log.info(method, 'No location found')
|
||
|
return nil
|
||
|
end
|
||
|
if vim.tbl_islist(result) then
|
||
|
vim.lsp.util.preview_location(result[1])
|
||
|
else
|
||
|
vim.lsp.util.preview_location(result)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function peek_definition()
|
||
|
local params = vim.lsp.util.make_position_params()
|
||
|
return vim.lsp.buf_request(0, 'textDocument/definition', params, preview_location_callback)
|
||
|
end
|