add dap and copilot
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||||
|
"CopilotChat.nvim": { "branch": "main", "commit": "75653259442a8eb895abfc70d7064e07aeb7134c" },
|
||||||
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
|
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
|
||||||
"auto-session": { "branch": "main", "commit": "00334ee24b9a05001ad50221c8daffbeedaa0842" },
|
"auto-session": { "branch": "main", "commit": "00334ee24b9a05001ad50221c8daffbeedaa0842" },
|
||||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||||
@@ -9,8 +10,9 @@
|
|||||||
"cmp-treesitter": { "branch": "master", "commit": "958fcfa0d8ce46d215e19cc3992c542f576c4123" },
|
"cmp-treesitter": { "branch": "master", "commit": "958fcfa0d8ce46d215e19cc3992c542f576c4123" },
|
||||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||||
"conform.nvim": { "branch": "master", "commit": "372fc521f8421b7830ea6db4d6ea3bae1c77548c" },
|
"conform.nvim": { "branch": "master", "commit": "372fc521f8421b7830ea6db4d6ea3bae1c77548c" },
|
||||||
|
"copilot.lua": { "branch": "master", "commit": "2f50ec4c16048153a50633053120292c9a7784bb" },
|
||||||
"friendly-snippets": { "branch": "main", "commit": "fc8f183479a472df60aa86f00e295462f2308178" },
|
"friendly-snippets": { "branch": "main", "commit": "fc8f183479a472df60aa86f00e295462f2308178" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "ee7e50dfbdf49e3acfa416fd3ad3abbdb658582c" },
|
"gitsigns.nvim": { "branch": "main", "commit": "140ac646db125904e456e42ab8b538d28f9607d7" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||||
"lazygit.nvim": { "branch": "main", "commit": "b9eae3badab982e71abab96d3ee1d258f0c07961" },
|
"lazygit.nvim": { "branch": "main", "commit": "b9eae3badab982e71abab96d3ee1d258f0c07961" },
|
||||||
"lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
|
"lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
|
||||||
@@ -21,14 +23,19 @@
|
|||||||
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
||||||
"nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" },
|
"nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
||||||
|
"nvim-dap": { "branch": "master", "commit": "98bf130702eaafad8567c0e3ea1171c2552d58bb" },
|
||||||
|
"nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" },
|
||||||
|
"nvim-dap-ui": { "branch": "master", "commit": "851f6f00480dc9366f37b6b91f3aeadb3b6ba04f" },
|
||||||
|
"nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" },
|
||||||
"nvim-lint": { "branch": "master", "commit": "9dfb77ef6c5092a19502883c02dc5a02ec648729" },
|
"nvim-lint": { "branch": "master", "commit": "9dfb77ef6c5092a19502883c02dc5a02ec648729" },
|
||||||
"nvim-lsp-file-operations": { "branch": "master", "commit": "9744b738183a5adca0f916527922078a965515ed" },
|
"nvim-lsp-file-operations": { "branch": "master", "commit": "9744b738183a5adca0f916527922078a965515ed" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "8b0f47d851ee5343d38fe194a06ad16b9b9bd086" },
|
"nvim-lspconfig": { "branch": "master", "commit": "8b0f47d851ee5343d38fe194a06ad16b9b9bd086" },
|
||||||
|
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||||
"nvim-tree.lua": { "branch": "master", "commit": "be5b788f2dc1522c73fb7afad9092331c8aebe80" },
|
"nvim-tree.lua": { "branch": "master", "commit": "be5b788f2dc1522c73fb7afad9092331c8aebe80" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "684eeac91ed8e297685a97ef70031d19ac1de25a" },
|
"nvim-treesitter": { "branch": "master", "commit": "684eeac91ed8e297685a97ef70031d19ac1de25a" },
|
||||||
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
|
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
|
||||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
|
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "68f70df44652d310d2adedf181b174c33a693665" },
|
"nvim-web-devicons": { "branch": "master", "commit": "50b5b06bff13a9b4eab946de7c7033649a6618a1" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" },
|
"telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" },
|
||||||
|
|||||||
94
lua/dkelly/plugins/dap.lua
Normal file
94
lua/dkelly/plugins/dap.lua
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
dependencies = {
|
||||||
|
"leoluz/nvim-dap-go",
|
||||||
|
"rcarriga/nvim-dap-ui",
|
||||||
|
"theHamsta/nvim-dap-virtual-text",
|
||||||
|
"nvim-neotest/nvim-nio",
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local dap = require("dap")
|
||||||
|
local ui = require("dapui")
|
||||||
|
|
||||||
|
require("dapui").setup()
|
||||||
|
require("dap-go").setup()
|
||||||
|
|
||||||
|
require("nvim-dap-virtual-text").setup({
|
||||||
|
-- This just tries to mitigate the chance that I leak tokens here. Probably won't stop it from happening...
|
||||||
|
display_callback = function(variable)
|
||||||
|
local name = string.lower(variable.name)
|
||||||
|
local value = string.lower(variable.value)
|
||||||
|
if name:match("secret") or name:match("api") or value:match("secret") or value:match("api") then
|
||||||
|
return "*****"
|
||||||
|
end
|
||||||
|
|
||||||
|
if #variable.value > 15 then
|
||||||
|
return " " .. string.sub(variable.value, 1, 15) .. "... "
|
||||||
|
end
|
||||||
|
|
||||||
|
return " " .. variable.value
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Handled by nvim-dap-go
|
||||||
|
-- dap.adapters.go = {
|
||||||
|
-- type = "server",
|
||||||
|
-- port = "${port}",
|
||||||
|
-- executable = {
|
||||||
|
-- command = "dlv",
|
||||||
|
-- args = { "dap", "-l", "127.0.0.1:${port}" },
|
||||||
|
-- },
|
||||||
|
-- }
|
||||||
|
|
||||||
|
local elixir_ls_debugger = vim.fn.exepath("elixir-ls-debugger")
|
||||||
|
if elixir_ls_debugger ~= "" then
|
||||||
|
dap.adapters.mix_task = {
|
||||||
|
type = "executable",
|
||||||
|
command = elixir_ls_debugger,
|
||||||
|
}
|
||||||
|
|
||||||
|
dap.configurations.elixir = {
|
||||||
|
{
|
||||||
|
type = "mix_task",
|
||||||
|
name = "phoenix server",
|
||||||
|
task = "phx.server",
|
||||||
|
request = "launch",
|
||||||
|
projectDir = "${workspaceFolder}",
|
||||||
|
exitAfterTaskReturns = false,
|
||||||
|
debugAutoInterpretAllModules = false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>bb", dap.toggle_breakpoint)
|
||||||
|
-- vim.keymap.set("n", "<leader>gb", dap.run_to_cursor)
|
||||||
|
|
||||||
|
-- Eval var under cursor
|
||||||
|
vim.keymap.set("n", "<leader>be", function()
|
||||||
|
require("dapui").eval(nil, { enter = true })
|
||||||
|
end)
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<F1>", dap.continue)
|
||||||
|
vim.keymap.set("n", "<F2>", dap.step_into)
|
||||||
|
vim.keymap.set("n", "<F3>", dap.step_over)
|
||||||
|
vim.keymap.set("n", "<F4>", dap.step_out)
|
||||||
|
vim.keymap.set("n", "<F5>", dap.step_back)
|
||||||
|
vim.keymap.set("n", "<F13>", dap.restart)
|
||||||
|
|
||||||
|
dap.listeners.before.attach.dapui_config = function()
|
||||||
|
ui.open()
|
||||||
|
end
|
||||||
|
dap.listeners.before.launch.dapui_config = function()
|
||||||
|
ui.open()
|
||||||
|
end
|
||||||
|
dap.listeners.before.event_terminated.dapui_config = function()
|
||||||
|
ui.close()
|
||||||
|
end
|
||||||
|
dap.listeners.before.event_exited.dapui_config = function()
|
||||||
|
ui.close()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
40
lua/dkelly/plugins/gh-copilot.lua
Normal file
40
lua/dkelly/plugins/gh-copilot.lua
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"CopilotC-Nvim/CopilotChat.nvim",
|
||||||
|
dependencies = {
|
||||||
|
-- Use whichever Copilot plugin you prefer, but configure it as above
|
||||||
|
{ "zbirenbaum/copilot.lua" },
|
||||||
|
{ "nvim-lua/plenary.nvim" },
|
||||||
|
},
|
||||||
|
build = "make tiktoken",
|
||||||
|
opts = {},
|
||||||
|
keys = {
|
||||||
|
{ "<leader>cc", "<cmd>CopilotChatToggle<cr>", desc = "Open Copilot Chat" },
|
||||||
|
},
|
||||||
|
cmd = { "CopilotChat" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"zbirenbaum/copilot.lua",
|
||||||
|
config = function()
|
||||||
|
require("copilot").setup({
|
||||||
|
suggestion = {
|
||||||
|
enabled = true,
|
||||||
|
auto_trigger = true,
|
||||||
|
keymap = {
|
||||||
|
accept = "<C-a>",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
panel = { enabled = false },
|
||||||
|
})
|
||||||
|
vim.keymap.set("n", "<leader>cs", function()
|
||||||
|
-- flips the auto_trigger for the current buffer
|
||||||
|
require("copilot.suggestion").toggle_auto_trigger()
|
||||||
|
-- read the buffer-local flag that Copilot sets under the hood
|
||||||
|
local on = vim.b.copilot_suggestion_auto_trigger or false
|
||||||
|
print("Copilot suggestions " .. (on and "enabled" or "disabled"))
|
||||||
|
end, { desc = "Toggle Copilot inline suggestions" })
|
||||||
|
end,
|
||||||
|
-- Don't lazy-load, CopilotChat needs backend running
|
||||||
|
event = "VeryLazy",
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -42,7 +42,7 @@ return {
|
|||||||
keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts) -- show lsp type definitions
|
keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts) -- show lsp type definitions
|
||||||
|
|
||||||
opts.desc = "See available code actions"
|
opts.desc = "See available code actions"
|
||||||
keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection
|
keymap.set({ "n", "v" }, "<leader>cz", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection
|
||||||
|
|
||||||
opts.desc = "Smart rename"
|
opts.desc = "Smart rename"
|
||||||
keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts) -- smart rename
|
keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts) -- smart rename
|
||||||
@@ -70,6 +70,38 @@ return {
|
|||||||
-- used to enable autocompletion (assign to every lsp server config)
|
-- used to enable autocompletion (assign to every lsp server config)
|
||||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||||
|
|
||||||
|
local on_attach = function(client, bufnr)
|
||||||
|
-- Enable completion triggered by <C-x><C-o>
|
||||||
|
vim.bo[bufnr].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||||
|
|
||||||
|
-- Define key mappings for LSP functionality
|
||||||
|
local opts = { noremap = true, silent = true, buffer = bufnr }
|
||||||
|
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||||
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||||
|
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
|
||||||
|
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts)
|
||||||
|
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
||||||
|
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
|
||||||
|
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
|
||||||
|
vim.keymap.set("n", "<leader>f", function()
|
||||||
|
vim.lsp.buf.format({ async = true })
|
||||||
|
end, opts)
|
||||||
|
|
||||||
|
-- Additional client-specific setup
|
||||||
|
if client.server_capabilities.document_highlight then
|
||||||
|
vim.api.nvim_create_augroup("LspDocumentHighlight", { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd("CursorHold", {
|
||||||
|
group = "LspDocumentHighlight",
|
||||||
|
buffer = bufnr,
|
||||||
|
callback = vim.lsp.buf.document_highlight,
|
||||||
|
})
|
||||||
|
vim.api.nvim_create_autocmd("CursorMoved", {
|
||||||
|
group = "LspDocumentHighlight",
|
||||||
|
buffer = bufnr,
|
||||||
|
callback = vim.lsp.buf.clear_references,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
-- Change the Diagnostic symbols in the sign column (gutter)
|
-- Change the Diagnostic symbols in the sign column (gutter)
|
||||||
-- (not in youtube nvim video)
|
-- (not in youtube nvim video)
|
||||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||||
@@ -102,6 +134,24 @@ return {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
["gopls"] = function()
|
||||||
|
lspconfig.gopls.setup({
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
cmd = { "gopls" },
|
||||||
|
filetypes = { "go", "gomod", "gowork", "gotmpl" },
|
||||||
|
root_dir = lspconfig.util.root_pattern("go.work", "go.mod", ".git"),
|
||||||
|
settings = {
|
||||||
|
gopls = {
|
||||||
|
completeUnimported = true,
|
||||||
|
usePlaceholder = true,
|
||||||
|
analyses = {
|
||||||
|
unusedparams = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,12 +31,10 @@ return {
|
|||||||
"cssls", -- CSS
|
"cssls", -- CSS
|
||||||
"gopls", -- Go
|
"gopls", -- Go
|
||||||
"html", -- HTML
|
"html", -- HTML
|
||||||
"tsserver", -- TypeScript/JavaScript
|
|
||||||
"jsonls", -- JSON
|
"jsonls", -- JSON
|
||||||
"lua_ls", -- Lua
|
"lua_ls", -- Lua
|
||||||
"marksman", -- Markdown
|
"marksman", -- Markdown
|
||||||
"pyright", -- Python
|
"pyright", -- Python
|
||||||
"ruby_ls", -- Ruby
|
|
||||||
"rust_analyzer", -- Rust
|
"rust_analyzer", -- Rust
|
||||||
"taplo", -- TOML
|
"taplo", -- TOML
|
||||||
"yamlls", -- YAML
|
"yamlls", -- YAML
|
||||||
|
|||||||
Reference in New Issue
Block a user