Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set breakpoint icons and their highlight colors #1194

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lua/kickstart/plugins/debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@ return {
},
}

-- Change breakpoint icons
-- For more information, see https://github.com/mfussenegger/nvim-dap/discussions/355
vim.api.nvim_set_hl(0, 'Break', { fg = '#e51400' })
vim.api.nvim_set_hl(0, 'Stop', { fg = '#ffcc00' })
local breakpoint_icons = vim.g.have_nerd_font
and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it be better to just have one table of icons

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for reviewing the code. With all due respect, that might not be possible.
If vim.g.have_nerd_font is false, the local variable breakpoint_icons would no longer exist.

Error that occurs when deleting the line:

Cannot assign `boolean|table` to parameter `<T:table>`.
   - `boolean` cannot match `table`
   - Type `boolean` cannot match `table` [param-type-mismatch]

or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
for type, icon in pairs(breakpoint_icons) do
local tp = 'Dap' .. type
local hl = (type == 'Stopped') and 'Stop' or 'Break'
vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
end

dap.listeners.after.event_initialized['dapui_config'] = dapui.open
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
dap.listeners.before.event_exited['dapui_config'] = dapui.close
Expand Down
Loading