update
This commit is contained in:
parent
24e7e25685
commit
c978f8ba5e
1 changed files with 54 additions and 7 deletions
61
init.lua
61
init.lua
|
|
@ -120,9 +120,56 @@ require("lazy").setup({
|
|||
{
|
||||
'rmagatti/auto-session',
|
||||
lazy = false,
|
||||
---@module "auto-session"
|
||||
---@type AutoSession.Config
|
||||
opts = {
|
||||
save_extra_data = function(_)
|
||||
local ok, breakpoints = pcall(require, "dap.breakpoints")
|
||||
if not ok or not breakpoints then
|
||||
return
|
||||
end
|
||||
|
||||
local bps = {}
|
||||
local breakpoints_by_buf = breakpoints.get()
|
||||
for buf, buf_bps in pairs(breakpoints_by_buf) do
|
||||
bps[vim.api.nvim_buf_get_name(buf)] = buf_bps
|
||||
end
|
||||
if vim.tbl_isempty(bps) then
|
||||
return
|
||||
end
|
||||
local extra_data = {
|
||||
breakpoints = bps,
|
||||
}
|
||||
return vim.fn.json_encode(extra_data)
|
||||
end,
|
||||
|
||||
restore_extra_data = function(_, extra_data)
|
||||
local json = vim.fn.json_decode(extra_data)
|
||||
|
||||
if json.breakpoints then
|
||||
local ok, breakpoints = pcall(require, "dap.breakpoints")
|
||||
|
||||
if not ok or not breakpoints then
|
||||
return
|
||||
end
|
||||
vim.notify("restoring breakpoints")
|
||||
for buf_name, buf_bps in pairs(json.breakpoints) do
|
||||
for _, bp in pairs(buf_bps) do
|
||||
local line = bp.line
|
||||
local opts = {
|
||||
condition = bp.condition,
|
||||
log_message = bp.logMessage,
|
||||
hit_condition = bp.hitCondition,
|
||||
}
|
||||
|
||||
local bufnr = vim.fn.bufnr(buf_name, true)
|
||||
if vim.fn.bufloaded(bufnr) == 0 then
|
||||
vim.api.nvim_buf_call(bufnr, vim.cmd.edit)
|
||||
end
|
||||
|
||||
breakpoints.set(opts, bufnr, line)
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -582,18 +629,18 @@ require("dapui").setup()
|
|||
vim.keymap.set('n', '<leader>dd', require("dapui").toggle, {})
|
||||
vim.keymap.set('n', '<leader>db', require("dap").toggle_breakpoint, {})
|
||||
vim.fn.sign_define('DapBreakpoint', {
|
||||
text = '',
|
||||
text = '🛑',
|
||||
texthl = 'DapBreakpoint',
|
||||
linehl = 'DapBreakpoint',
|
||||
numhl =
|
||||
'DapBreakpoint'
|
||||
})
|
||||
vim.fn.sign_define('DapBreakpointCondition',
|
||||
{ text = 'ﳁ', texthl = 'DapBreakpoint', linehl = 'DapBreakpoint', numhl = 'DapBreakpoint' })
|
||||
{ text = '❓', texthl = 'DapBreakpoint', linehl = 'DapBreakpoint', numhl = 'DapBreakpoint' })
|
||||
vim.fn.sign_define('DapBreakpointRejected',
|
||||
{ text = '', texthl = 'DapBreakpoint', linehl = 'DapBreakpoint', numhl = 'DapBreakpoint' })
|
||||
vim.fn.sign_define('DapLogPoint', { text = '', texthl = 'DapLogPoint', linehl = 'DapLogPoint', numhl = 'DapLogPoint' })
|
||||
vim.fn.sign_define('DapStopped', { text = '', texthl = 'DapStopped', linehl = 'DapStopped', numhl = 'DapStopped' })
|
||||
{ text = '❗', texthl = 'DapBreakpoint', linehl = 'DapBreakpoint', numhl = 'DapBreakpoint' })
|
||||
vim.fn.sign_define('DapLogPoint', { text = 'ℹ️', texthl = 'DapLogPoint', linehl = 'DapLogPoint', numhl = 'DapLogPoint' })
|
||||
vim.fn.sign_define('DapStopped', { text = '▶️', texthl = 'DapStopped', linehl = 'DapStopped', numhl = 'DapStopped' })
|
||||
vim.api.nvim_set_hl(0, 'DapBreakpoint', { ctermbg = 0, fg = '#993939', bg = '#31353f' })
|
||||
vim.api.nvim_set_hl(0, 'DapLogPoint', { ctermbg = 0, fg = '#61afef', bg = '#31353f' })
|
||||
vim.api.nvim_set_hl(0, 'DapStopped', { ctermbg = 0, fg = '#98c379', bg = '#31353f' })
|
||||
|
|
|
|||
Loading…
Reference in a new issue