Support default breakpoints filters for exceptions (#943)

This commit is contained in:
Ezio Li 2024-01-19 11:46:35 +08:00 коммит произвёл GitHub
Родитель 1e0465e3d8
Коммит 6f7c0734ac
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 31 добавлений и 1 удалений

Просмотреть файл

@ -7,6 +7,7 @@ import * as vscode from "vscode";
import * as nls from "vscode-nls";
import {
ErrorDestination,
InitializedEvent,
logger,
Logger,
LoggingDebugSession,
@ -174,6 +175,36 @@ export default class CordovaDebugSession extends LoggingDebugSession {
);
}
protected initializeRequest(
response: DebugProtocol.InitializeResponse,
args: DebugProtocol.InitializeRequestArguments,
): void {
// Support default breakpoints filters for exceptions
response.body.exceptionBreakpointFilters = [
{
filter: "all",
label: "Caught Exceptions",
default: false,
supportsCondition: true,
description: "Breaks on all throw errors, even if they're caught later.",
// eslint-disable-next-line @typescript-eslint/quotes
conditionDescription: 'error.name == "MyError"',
},
{
filter: "uncaught",
label: "Uncaught Exceptions",
default: false,
supportsCondition: true,
description: "Breaks only on errors or promise rejections that are not handled.",
// eslint-disable-next-line @typescript-eslint/quotes
conditionDescription: 'error.name == "MyError"',
},
];
this.sendResponse(response);
this.sendEvent(new InitializedEvent());
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
protected async launchRequest(
response: DebugProtocol.LaunchResponse,
@ -230,7 +261,6 @@ export default class CordovaDebugSession extends LoggingDebugSession {
Object.assign(launchArgs, launchResult);
await this.vsCodeDebugSession.customRequest("attach", launchArgs);
this.sendResponse(response);
this.cordovaSession.setStatus(CordovaSessionStatus.Activated);
});