diff --git a/package.json b/package.json index dc8466b7..006d2e8e 100644 --- a/package.json +++ b/package.json @@ -186,6 +186,37 @@ }, "type": "object" }, + "breakOnSystemExit": { + "description": "Controls which SystemExit exit codes cause the debugger to break. Accepts an array of exit codes and/or inclusive ranges. Set to an empty array to never break on SystemExit. When omitted, the debugger's default applies: successful exits (SystemExit(0) and SystemExit(None), plus 3 under Django/Flask) are ignored, and any other code causes a break when uncaught-exception breaking is enabled.", + "type": "array", + "items": { + "oneOf": [ + { + "type": "integer", + "description": "A specific SystemExit code to break on." + }, + { + "type": "object", + "additionalProperties": false, + "description": "An inclusive range of SystemExit codes to break on.", + "properties": { + "from": { + "type": "integer", + "description": "Lower bound of the range (inclusive)." + }, + "to": { + "type": "integer", + "description": "Upper bound of the range (inclusive)." + } + }, + "required": [ + "from", + "to" + ] + } + ] + } + }, "connect": { "label": "Attach by connecting to debugpy over a socket.", "properties": { @@ -405,6 +436,37 @@ }, "type": "object" }, + "breakOnSystemExit": { + "description": "Controls which SystemExit exit codes cause the debugger to break. Accepts an array of exit codes and/or inclusive ranges. Set to an empty array to never break on SystemExit. When omitted, the debugger's default applies: successful exits (SystemExit(0) and SystemExit(None), plus 3 under Django/Flask) are ignored, and any other code causes a break when uncaught-exception breaking is enabled.", + "type": "array", + "items": { + "oneOf": [ + { + "type": "integer", + "description": "A specific SystemExit code to break on." + }, + { + "type": "object", + "additionalProperties": false, + "description": "An inclusive range of SystemExit codes to break on.", + "properties": { + "from": { + "type": "integer", + "description": "Lower bound of the range (inclusive)." + }, + "to": { + "type": "integer", + "description": "Upper bound of the range (inclusive)." + } + }, + "required": [ + "from", + "to" + ] + } + ] + } + }, "console": { "default": "integratedTerminal", "description": "Where to launch the debug target: internal console, integrated terminal, or external terminal.", diff --git a/src/extension/types.ts b/src/extension/types.ts index 1b007add..37dcb738 100644 --- a/src/extension/types.ts +++ b/src/extension/types.ts @@ -43,6 +43,11 @@ export type PathMapping = { remoteRoot: string; }; +export type SystemExitRange = { + from: number; + to: number; +}; + type Connection = { host?: string; port?: number | string; @@ -69,6 +74,9 @@ interface ICommonDebugArguments { // Show return values of functions while stepping. showReturnValue?: boolean; subProcess?: boolean; + // SystemExit codes (and/or inclusive ranges) that cause the debugger to break. + // An empty array disables breaking on SystemExit entirely. + breakOnSystemExit?: (number | SystemExitRange)[]; // An absolute path to local directory with source. pathMappings?: PathMapping[]; }