use telescope for [g]et [r]eferences

main
Gabe Farrell 2 years ago
parent 15ab840ed5
commit d2c7d4a064

@ -1,5 +1,37 @@
-- EXAMPLE
local on_attach = require("nvchad.configs.lspconfig").on_attach
local map = vim.keymap.set
local conf = require("nvconfig").ui.lsp
local on_attach = function(client, bufnr)
local function opts(desc)
return { buffer = bufnr, desc = desc }
end
map("n", "gD", vim.lsp.buf.declaration, opts "Lsp Go to declaration")
map("n", "gd", vim.lsp.buf.definition, opts "Lsp Go to definition")
map("n", "K", vim.lsp.buf.hover, opts "Lsp hover information")
map("n", "gi", vim.lsp.buf.implementation, opts "Lsp Go to implementation")
map("n", "<leader>sh", vim.lsp.buf.signature_help, opts "Lsp Show signature help")
map("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, opts "Lsp Add workspace folder")
map("n", "<leader>wr", vim.lsp.buf.remove_workspace_folder, opts "Lsp Remove workspace folder")
map("n", "<leader>wl", function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, opts "Lsp List workspace folders")
map("n", "<leader>D", vim.lsp.buf.type_definition, opts "Lsp Go to type definition")
map("n", "<leader>ra", function()
require "nvchad.lsp.renamer"()
end, opts "Lsp NvRenamer")
map({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts "Lsp Code action")
map("n", "gr", "<cmd>Telescope lsp_references<CR>", opts "[G]et [R]eferences")
-- setup signature popup
if conf.signature and client.server_capabilities.signatureHelpProvider then
require("nvchad.lsp.signature").setup(client, bufnr)
end
end
local on_init = require("nvchad.configs.lspconfig").on_init
local capabilities = require("nvchad.configs.lspconfig").capabilities

Loading…
Cancel
Save