Updating debug

This commit is contained in:
Chris
2025-05-07 07:58:00 +01:00
parent ed622165b8
commit b8d7a1c9ab
3 changed files with 97 additions and 13 deletions

View File

@@ -138,8 +138,8 @@ vim.api.nvim_create_autocmd('FileType', {
local models = { 'gpt-4.1', 'gemini-2.5-pro', 'gemini-2.0-flash-001', 'claude-3.7-sonnet-thought', 'o4-mini' }
-- Loop through models and create keymaps for each
for i, model in ipairs(models) do
vim.keymap.set('n', '<C-' .. i .. '>', 'mzggj0WC' .. model .. '<Esc>`z', { buffer = true, desc = 'Switch to ' .. model })
vim.keymap.set('i', '<C-' .. i .. '>', '<Esc>mzggj0WC' .. model .. '<Esc>`za', { buffer = true, desc = 'Switch to ' .. model })
vim.keymap.set('n', '<C-' .. i .. '>', 'mzggj0W"_C' .. model .. '<Esc>`z', { desc = 'Switch to ' .. model })
vim.keymap.set('i', '<C-' .. i .. '>', '<Esc>mzggj0W"_C' .. model .. '<Esc>`za', { desc = 'Switch to ' .. model })
end
end,
})
@@ -189,8 +189,33 @@ local test_maps = {
{
keys = { '<F10>', '<Leader>td' },
action = function()
require('neotest').run.run_last { strategy = 'dap' }
require('neotest').summary.open() -- Note: Doesn't call open_test() like the others
local dap = require 'dap'
if dap.session() == nil then
dap.continue()
end
require('dapui').open()
local neotest = require 'neotest'
local bufnr = vim.api.nvim_get_current_buf()
local row = vim.api.nvim_win_get_cursor(0)[1] - 1
local adapters = neotest.state.adapter_ids()
local found = false
for _, adapter_id in ipairs(adapters) do
local tree = neotest.state.positions(adapter_id, { buffer = bufnr })
if tree then
local nearest = require('neotest.lib.positions').nearest(tree, row)
if nearest and nearest:data().type ~= 'file' then
neotest.run.run()
found = true
break
end
end
end
if not found then
neotest.run.run_last()
end
end,
desc = 'Run last test with debugger',
},