Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions lua/dap/breakpoints.lua
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ do
local text_parts = {
unpack(api.nvim_buf_get_lines(bufnr, bp.line - 1, bp.line, false), 1),
state.verified == false and (state.message and 'Rejected: ' .. state.message or 'Rejected') or nil,
non_empty(bp.logMessage) and "Log message: " .. bp.logMessage,
non_empty(bp.condition) and "Condition: " .. bp.condition,
non_empty(bp.hitCondition) and "Hit condition: " .. bp.hitCondition,
non_empty(bp.logMessage) and "Log message: " .. bp.logMessage or nil,
non_empty(bp.condition) and "Condition: " .. bp.condition or nil,
non_empty(bp.hitCondition) and "Hit condition: " .. bp.hitCondition or nil,
}
local text = table.concat(vim.tbl_filter(not_nil, text_parts), ', ')
table.insert(qf_list, {
Expand Down
4 changes: 3 additions & 1 deletion lua/dap/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ function M.to_dict(values, get_key, get_value)
end


---@param object? table|string
---@return boolean
function M.non_empty(object)
if type(object) == "table" then
return next(object) ~= nil
end
return object and #object > 0
return object and #object > 0 or false
end


Expand Down
20 changes: 20 additions & 0 deletions tests/breakpoints_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,25 @@ describe('breakpoints', function()
},
breakpoints.to_qf_list(breakpoints.get())
)

local bps = {
[buf] = {
{
line = 1,
condition = ""
},
}
}
assert.are.same(
{
{
bufnr = buf,
col = 0,
lnum = 1,
text = "Hello breakpoint"
}
},
breakpoints.to_qf_list(bps)
)
end)
end)