parent
f01b1d6a52
commit
eebffce98e
1 changed files with 14 additions and 0 deletions
|
@ -5,6 +5,19 @@ local ts_utils = require("nvim-lsp-ts-utils")
|
|||
local null_ls = require("null-ls")
|
||||
local util = require("lspconfig/util")
|
||||
|
||||
-- https://github.com/neovim/nvim-lspconfig/wiki/User-contributed-tips
|
||||
local function preview_location_callback(_, result)
|
||||
if result == nil or vim.tbl_isempty(result) then
|
||||
return nil
|
||||
end
|
||||
vim.lsp.util.preview_location(result[1])
|
||||
end
|
||||
|
||||
function PeekDefinition()
|
||||
local params = vim.lsp.util.make_position_params()
|
||||
return vim.lsp.buf_request(0, 'textDocument/definition', params, preview_location_callback)
|
||||
end
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
signature.on_attach({
|
||||
bind = true,
|
||||
|
@ -33,6 +46,7 @@ local on_attach = function(client, bufnr)
|
|||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '1gd' , '<cmd>lua vim.lsp.buf.document_symbol()<CR>' , opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '1gD' , '<cmd>lua vim.lsp.buf.workspace_symbol()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gR' , '<cmd>lua vim.lsp.buf.rename()<CR>' , opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'pd' , '<cmd>lua PeekDefinition()<CR>' , opts)
|
||||
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev { wrap = false }<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next { wrap = false }<CR>', opts)
|
||||
|
|
Loading…
Reference in a new issue