blob: 08ff22d72ff746cadfdecd7faee3a5e4c1d2d678 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
local M = {}
function M.lsp_peek()
local params = vim.lsp.util.make_position_params()
return vim.lsp.buf_request(0, 'textDocument/definition', params,
function(_, result, module, _)
if result == nil or vim.tbl_isempty(result) then
vim.lsp.log.info(module, '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)
end
function M.config_home()
return os.getenv('XDG_CONFIG_HOME') or (vim.fn.expand('~') .. '/.config')
end
return M
|