- [NEW] Ja para en les excepcions i mostra on, el stack trace, i tota la peixca...
This commit is contained in:
@@ -32,6 +32,7 @@ constructor() {
|
|||||||
this.programStarted = false;
|
this.programStarted = false;
|
||||||
this._nextVarRef = 100;
|
this._nextVarRef = 100;
|
||||||
this._varRefMap = new Map();
|
this._varRefMap = new Map();
|
||||||
|
this._exceptionFilters = new Set(["uncaught"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeRequest(response, args) {
|
initializeRequest(response, args) {
|
||||||
@@ -62,9 +63,13 @@ constructor() {
|
|||||||
supportsClipboardContext: false,
|
supportsClipboardContext: false,
|
||||||
supportsValueFormattingOptions: false,
|
supportsValueFormattingOptions: false,
|
||||||
supportsExceptionOptions: false,
|
supportsExceptionOptions: false,
|
||||||
supportsExceptionFilterOptions: false,
|
supportsExceptionFilterOptions: true,
|
||||||
supportsSingleThreadExecutionRequests: true
|
supportsSingleThreadExecutionRequests: true
|
||||||
};
|
};
|
||||||
|
response.body.exceptionBreakpointFilters = [
|
||||||
|
{ filter: "all", label: "Break on all exceptions", default: false },
|
||||||
|
{ filter: "uncaught", label: "Break on uncaught exceptions", default: true }
|
||||||
|
];
|
||||||
|
|
||||||
this.sendResponse(response);
|
this.sendResponse(response);
|
||||||
}
|
}
|
||||||
@@ -121,10 +126,20 @@ constructor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (json.type === "stackTrace") {
|
if (json.type === "stackTrace") {
|
||||||
console.log("[ADAPTER] STACKTRACE PAYLOAD:", JSON.stringify(json.payload));
|
this._lastStackFrames = json.payload.stackFrames;
|
||||||
console.log("[ADAPTER] BEFORE HANDLING STACKTRACE");
|
this._lastTotalFrames = json.payload.totalFrames;
|
||||||
this.pendingStackTrace(json.payload.frames);
|
|
||||||
console.log("[ADAPTER] AFTER HANDLING STACKTRACE");
|
if (this._pendingStackTraceResponse) {
|
||||||
|
const resp = this._pendingStackTraceResponse;
|
||||||
|
this._pendingStackTraceResponse = null;
|
||||||
|
|
||||||
|
resp.body = {
|
||||||
|
stackFrames: this._lastStackFrames,
|
||||||
|
totalFrames: this._lastTotalFrames
|
||||||
|
};
|
||||||
|
|
||||||
|
this.sendResponse(resp);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,6 +241,11 @@ constructor() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (json.type === "stopped" && json.payload.reason === "exception") {
|
||||||
|
this.sendEvent(new StoppedEvent("exception", 1, json.payload.text));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// salida normal
|
// salida normal
|
||||||
this.sendEvent(new OutputEvent(line + "\n", "stdout"));
|
this.sendEvent(new OutputEvent(line + "\n", "stdout"));
|
||||||
}
|
}
|
||||||
@@ -278,6 +298,11 @@ constructor() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.sendDebugCommand({
|
||||||
|
cmd: "setExceptionFilters",
|
||||||
|
filters: [...this._exceptionFilters]
|
||||||
|
});
|
||||||
|
|
||||||
this.sendEvent(new ThreadEvent("started", 1));
|
this.sendEvent(new ThreadEvent("started", 1));
|
||||||
|
|
||||||
this.sendResponse(response);
|
this.sendResponse(response);
|
||||||
@@ -410,11 +435,23 @@ constructor() {
|
|||||||
stackTraceRequest(response, args) {
|
stackTraceRequest(response, args) {
|
||||||
console.log("[ADAPTER] stackTraceRequest");
|
console.log("[ADAPTER] stackTraceRequest");
|
||||||
|
|
||||||
// Pedimos el stack trace al motor
|
if (!this._lastStackFrames) {
|
||||||
this.sendDebugCommand({ cmd: "stackTrace" });
|
// Pedimos el stack trace al motor
|
||||||
|
this.sendDebugCommand({ cmd: "stackTrace" });
|
||||||
|
// Guardar el response para enviarlo más tarde
|
||||||
|
this._pendingStackTraceResponse = response;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si ya tenemos frames, responder inmediatamente
|
||||||
|
response.body = {
|
||||||
|
stackFrames: this._lastStackFrames,
|
||||||
|
totalFrames: this._lastTotalFrames
|
||||||
|
};
|
||||||
|
|
||||||
|
this.sendResponse(response);
|
||||||
// Esperamos la respuesta del motor
|
// Esperamos la respuesta del motor
|
||||||
const check = () => {
|
/* const check = () => {
|
||||||
if (this._stackFrames && this._stackFrames.length > 0) {
|
if (this._stackFrames && this._stackFrames.length > 0) {
|
||||||
const frames = this._stackFrames;
|
const frames = this._stackFrames;
|
||||||
this._stackFrames = [];
|
this._stackFrames = [];
|
||||||
@@ -437,7 +474,7 @@ constructor() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
check();
|
check();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
makeVarRef(type, frameId) {
|
makeVarRef(type, frameId) {
|
||||||
@@ -567,6 +604,18 @@ constructor() {
|
|||||||
this.sendResponse(response);
|
this.sendResponse(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setExceptionBreakPointsRequest(response, args) {
|
||||||
|
// Si VSCode envía filtros explícitos, los usamos
|
||||||
|
if (args.filters && args.filters.length > 0) {
|
||||||
|
this._exceptionFilters = new Set(args.filters);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si VSCode envía [], NO tocamos los filtros por defecto
|
||||||
|
|
||||||
|
response.body = {};
|
||||||
|
this.sendResponse(response);
|
||||||
|
}
|
||||||
|
|
||||||
configurationDoneRequest(response, args) {
|
configurationDoneRequest(response, args) {
|
||||||
console.log("[ADAPTER] configurationDoneRequest");
|
console.log("[ADAPTER] configurationDoneRequest");
|
||||||
this.sendResponse(response);
|
this.sendResponse(response);
|
||||||
|
|||||||
Reference in New Issue
Block a user