@@ -71,14 +71,12 @@ return {
71
71
local function find_bp ()
72
72
local buf_bps = require (' dap.breakpoints' ).get (vim .fn .bufnr ())[vim .fn .bufnr ()]
73
73
--- @type dap.SourceBreakpoint
74
- local bp = { condition = ' ' , logMessage = ' ' , hitCondition = ' ' , line = vim .fn .line ' .' }
75
74
for _ , candidate in ipairs (buf_bps ) do
76
75
if candidate .line and candidate .line == vim .fn .line ' .' then
77
- bp = candidate
78
- break
76
+ return candidate
79
77
end
80
78
end
81
- return bp
79
+ return { condition = ' ' , logMessage = ' ' , hitCondition = ' ' , line = vim . fn . line ' . ' }
82
80
end
83
81
84
82
-- Elicit customization via a UI prompt
@@ -105,16 +103,23 @@ return {
105
103
},
106
104
}
107
105
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 )
110
108
end
111
109
vim .ui .select (menu_options , {
112
110
prompt = ' Edit Breakpoint' ,
111
+ format_item = function (item )
112
+ return (' %s: %s' ):format (item , props [item ].value )
113
+ end ,
113
114
}, 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 ,
118
123
})
119
124
120
125
-- Set breakpoint for current line, with customizations (see h:dap.set_breakpoint())
0 commit comments