|
|
@ -1,53 +1,38 @@
|
|
|
|
local M = {}
|
|
|
|
local M = {}
|
|
|
|
|
|
|
|
|
|
|
|
M.default_config = {
|
|
|
|
local map = function(mode, lhs, rhs, opts)
|
|
|
|
on_attach = function(client, bufnr)
|
|
|
|
vim.keymap.set(mode, lhs, rhs, { buffer = opts[1], desc = opts[2] })
|
|
|
|
require("lsp_signature").on_attach({}, bufnr)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- add lsp-only keybinds
|
|
|
|
|
|
|
|
local map = function(sequence, cmd, desc)
|
|
|
|
|
|
|
|
vim.keymap.set("n", sequence, cmd, { buffer = bufnr, desc = desc })
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
M.map = map
|
|
|
|
|
|
|
|
|
|
|
|
map("K", vim.lsp.buf.hover, "Hover")
|
|
|
|
M.default_config = {
|
|
|
|
map("]d", vim.diagnostic.goto_next, "Next diagnostic")
|
|
|
|
on_attach = function(_, bufnr)
|
|
|
|
map("[d", vim.diagnostic.goto_prev, "Previous diagnostic")
|
|
|
|
map("n", "K", vim.lsp.buf.hover, { bufnr, "Hover Information" })
|
|
|
|
|
|
|
|
map("n", "]d", vim.diagnostic.goto_next, { bufnr, "Next Diagnostic" })
|
|
|
|
|
|
|
|
map("n", "[d", vim.diagnostic.goto_prev, { bufnr, "Previous Diagnostic" })
|
|
|
|
|
|
|
|
|
|
|
|
map("gs", vim.lsp.buf.signature_help, "LSP Signature Help")
|
|
|
|
map("n", "gs", vim.lsp.buf.signature_help, { bufnr, "Signature Help" })
|
|
|
|
map("gD", vim.lsp.buf.declaration, "LSP Declarations")
|
|
|
|
map("n", "gD", vim.lsp.buf.declaration, { bufnr, "Declarations" })
|
|
|
|
map("gd", function()
|
|
|
|
map("n", "gd", "<cmd>Telescope lsp_definitions<CR>", { bufnr, "Definitions" })
|
|
|
|
require("telescope.builtin").lsp_definitions()
|
|
|
|
map("n", "gT", "<cmd>Telescope lsp_type_definitions<CR>", { bufnr, "Type Definitions" })
|
|
|
|
end, "LSP Definitions")
|
|
|
|
map("n", "gr", "<cmd>Telescope lsp_references<CR>", { bufnr, "References" })
|
|
|
|
map("gT", function()
|
|
|
|
map("n", "gI", "<cmd>Telescope lsp_implementations<CR>", { bufnr, "Implementations" })
|
|
|
|
require("telescope.builtin").lsp_type_definitions()
|
|
|
|
map("n", "gl", function()
|
|
|
|
end, "LSP Type Definitions")
|
|
|
|
vim.diagnostic.open_float(0, { scope = "line" })
|
|
|
|
map("gr", function()
|
|
|
|
end, { bufnr, "LSP Line Diagnostics" })
|
|
|
|
require("telescope.builtin").lsp_references()
|
|
|
|
|
|
|
|
end, "LSP References")
|
|
|
|
|
|
|
|
map("gI", function()
|
|
|
|
|
|
|
|
require("telescope.builtin").lsp_implementations()
|
|
|
|
|
|
|
|
end, "LSP Implementations")
|
|
|
|
|
|
|
|
map("gl", function()
|
|
|
|
|
|
|
|
vim.diagnostic.open_float(0, {
|
|
|
|
|
|
|
|
scope = "line",
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map("<leader>la", vim.lsp.buf.code_action, "Code Action")
|
|
|
|
map("n", "<leader>la", vim.lsp.buf.code_action, { bufnr, "Code Action" })
|
|
|
|
map("<leader>lr", vim.lsp.buf.rename, "Rename")
|
|
|
|
map("n", "<leader>lr", vim.lsp.buf.rename, { bufnr, "Rename" })
|
|
|
|
map("<leader>lf", vim.lsp.buf.format, "Format")
|
|
|
|
map("n", "<leader>lf", vim.lsp.buf.format, { bufnr, "Format" })
|
|
|
|
map("<leader>ld", function()
|
|
|
|
map("n", "<leader>ld", "<cmd>Telescope diagnostics<CR>", { bufnr, "Workspace Diagnostics" })
|
|
|
|
require("telescope.builtin").diagnostics()
|
|
|
|
map("n", "<leader>lD", "<cmd>Telescope diagnostics bufnr=0<CR>", { bufnr, "Buffer Diagnostics" })
|
|
|
|
end, "LSP Workplace Diagnostics")
|
|
|
|
map("n", "<leader>ls", "<cmd>Telescope lsp_document_symbols<CR>", { bufnr, "Document Symbols" })
|
|
|
|
map("<leader>lD", function()
|
|
|
|
map("n", "<leader>lS", "<cmd>Telescope lsp_workspace_symbols<CR>", { bufnr, "Workspace Symbols" })
|
|
|
|
require("telescope.builtin").diagnostics({ bufnr = 0 })
|
|
|
|
map("n", "<leader>lwa", vim.lsp.buf.add_workspace_folder, { bufnr, "Add Workspace Folder" })
|
|
|
|
end, "LSP Buffer Diagnostics")
|
|
|
|
map("n", "<leader>lwr", vim.lsp.buf.remove_workspace_folder, { bufnr, "Remove Workspace Folder" })
|
|
|
|
map("<leader>ls", function()
|
|
|
|
map("n", "<leader>lwl", function()
|
|
|
|
require("telescope.builtin").lsp_document_symbols()
|
|
|
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
|
|
|
end, "LSP Document Symbols")
|
|
|
|
end, { bufnr, "List Workspace Folders" })
|
|
|
|
map("<leader>lS", function()
|
|
|
|
|
|
|
|
require("telescope.builtin").lsp_workspace_symbols()
|
|
|
|
|
|
|
|
end, "LSP Workplace Symbols")
|
|
|
|
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|