Skip to content

Commit 8cef473

Browse files
committed
Fix CR suggestions
1 parent 8bd125f commit 8cef473

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

lua/kickstart/plugins/debug.lua

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,12 @@ return {
7171
local function find_bp()
7272
local buf_bps = require('dap.breakpoints').get(vim.fn.bufnr())[vim.fn.bufnr()]
7373
---@type dap.SourceBreakpoint
74-
local bp = { condition = '', logMessage = '', hitCondition = '', line = vim.fn.line '.' }
7574
for _, candidate in ipairs(buf_bps) do
7675
if candidate.line and candidate.line == vim.fn.line '.' then
77-
bp = candidate
78-
break
76+
return candidate
7977
end
8078
end
81-
return bp
79+
return { condition = '', logMessage = '', hitCondition = '', line = vim.fn.line '.' }
8280
end
8381

8482
-- Elicit customization via a UI prompt
@@ -105,16 +103,23 @@ return {
105103
},
106104
}
107105
local menu_options = {}
108-
for k, v in pairs(props) do
109-
table.insert(menu_options, ('%s: %s'):format(k, v.value))
106+
for k, _ in pairs(props) do
107+
table.insert(menu_options, k)
110108
end
111109
vim.ui.select(menu_options, {
112110
prompt = 'Edit Breakpoint',
111+
format_item = function(item)
112+
return ('%s: %s'):format(item, props[item].value)
113+
end,
113114
}, function(choice)
114-
local prompt = (tostring(choice)):gsub(':.*', '')
115-
props[prompt].setter(vim.fn.input {
116-
prompt = ('[%s] '):format(prompt),
117-
default = props[prompt].value,
115+
if choice == nil then
116+
-- User cancelled the selection
117+
return
118+
end
119+
120+
props[choice].setter(vim.fn.input {
121+
prompt = ('[%s] '):format(choice),
122+
default = props[choice].value,
118123
})
119124

120125
-- Set breakpoint for current line, with customizations (see h:dap.set_breakpoint())

0 commit comments

Comments
 (0)