Stop for today

This commit is contained in:
Smaug123
2024-03-24 21:08:06 +00:00
parent b94098e5af
commit 75cebeaa7a
3 changed files with 65 additions and 1 deletions

View File

@@ -162,6 +162,7 @@
ps.pyyaml ps.pyyaml
ps.std2 ps.std2
]); ]);
debugPyEnv = nixpkgs.python3.withPackages (ps: [ps.debugpy]);
in { in {
enable = true; enable = true;
plugins = [ plugins = [
@@ -247,6 +248,11 @@
config = builtins.readFile ./nvim/nvim-dap.lua; config = builtins.readFile ./nvim/nvim-dap.lua;
type = "lua"; type = "lua";
} }
{
plugin = nixpkgs.vimPlugins.nvim-dap-python;
config = builtins.replaceStrings ["%PYTHONENV%"] ["${debugPyEnv}"] (builtins.readFile ./nvim/nvim-dap-python.lua);
type = "lua";
}
]; ];
viAlias = true; viAlias = true;
vimAlias = true; vimAlias = true;

View File

@@ -0,0 +1 @@
require("dap-python").setup("%PYTHONENV%/bin/python")

View File

@@ -1,8 +1,9 @@
local dap = require("dap") local dap = require("dap")
local dap_ui = require("dap.ui.widgets")
dap.adapters.coreclr = { dap.adapters.coreclr = {
type = "executable", type = "executable",
command = "netcoredbg", command = "netcoredbg",
args = { "--interpreter=vscode" }, args = { "--interpreter=vscode", "--", "dotnet" },
} }
dap.configurations.fsharp = { dap.configurations.fsharp = {
@@ -15,3 +16,59 @@ dap.configurations.fsharp = {
end, end,
}, },
} }
local status, whichkey = pcall(require, "which-key")
if status then
whichkey.register({
d = {
o = { dap.step_over, "Step over" },
i = { dap.step_into, "Step into" },
c = { dap.continue, "Continue" },
C = { dap.run_last, "Run with last debug configuration" },
b = { dap.toggle_breakpoint, "Toggle breakpoint" },
r = { dap.repl.open, "Open debug repl" },
v = {
v = {
function()
dap_ui.hover()
end,
"View value of expression under cursor",
},
s = {
function()
dap_ui.sidebar(dap_ui.scopes).open()
end,
"View values of all variables in all scopes",
},
f = {
function()
dap_ui.sidebar(dap_ui.frames).open()
end,
"View stack frames",
},
},
t = { dap.terminate, "Terminate/stop/end debug session" },
},
}, { prefix = vim.api.nvim_get_var("maplocalleader") })
else
vim.api.nvim_set_keymap("n", "<localleader>do", ":lua require('dap').step_over()<CR>", { noremap = true })
vim.api.nvim_set_keymap("n", "<localleader>di", ":lua require('dap').step_into()<CR>", { noremap = true })
vim.api.nvim_set_keymap("n", "<localleader>dc", ":lua require('dap').continue()<CR>", { noremap = true })
vim.api.nvim_set_keymap("n", "<localleader>dC", ":lua require('dap').run_last()<CR>", { noremap = true })
vim.api.nvim_set_keymap("n", "<localleader>db", ":lua require('dap').toggle_breakpoint()<CR>", { noremap = true })
vim.api.nvim_set_keymap("n", "<localleader>dr", ":lua require('dap').repl.open()<CR>", { noremap = true })
vim.api.nvim_set_keymap("n", "<localleader>dvv", ":lua require('dap.ui.widgets').hover()<CR>", { noremap = true })
vim.api.nvim_set_keymap(
"n",
"<localleader>dvs",
":lua require('dap.ui.widgets').sidebar(require('dap.ui.widgets').scopes).open()<CR>",
{ noremap = true }
)
vim.api.nvim_set_keymap(
"n",
"<localleader>dvf",
":lua require('dap.ui.widgets').sidebar(require('dap.ui.widgets').frames).open()<CR>",
{ noremap = true }
)
vim.api.nvim_set_keymap("n", "<localleader>dt", ":lua require('dap').terminate()<CR>", { noremap = true })
end