Return dap.ABORT if pick_process is cancelled

This commit is contained in:
Mathias Fussenegger 2024-05-23 19:11:45 +02:00 committed by Mathias Fußenegger
parent 083b9f33a7
commit c65c163daa
2 changed files with 3 additions and 2 deletions

View file

@ -28,6 +28,7 @@ local function notify(...)
end
--- Sentinel value; signals an operation should be aborted.
---@class dap.Abort
M.ABORT = {}
M.status = function(...)

View file

@ -165,7 +165,7 @@ function M.pick_process(opts)
local ui = require("dap.ui")
local pick = (co and not ismain) and ui.pick_one or ui.pick_one_sync
local result = pick(procs, "Select process: ", label_fn)
return result and result.pid or nil
return result and result.pid or require("dap").ABORT
end
@ -261,7 +261,7 @@ end
--- </pre>
---@param opts? {filter?: string|(fun(name: string): boolean), executables?: boolean, path?: string}
---
---@return thread|string|nil|table
---@return thread|string|dap.Abort
function M.pick_file(opts)
opts = opts or {}
local executables = opts.executables == nil and true or opts.executables