Fix debugger watch window freeze caused by missing responses (#781)

This commit is contained in:
MichaelXt
2025-01-26 10:33:50 -08:00
committed by GitHub
parent 002cfa18a3
commit e7b9530a7f
2 changed files with 10 additions and 18 deletions

View File

@@ -25,7 +25,6 @@ interface Variable {
variable: GodotVariable;
index: number;
object_id: number;
error: string;
}
export class GodotDebugSession extends LoggingDebugSession {
@@ -126,17 +125,16 @@ export class GodotDebugSession extends LoggingDebugSession {
await debug.activeDebugSession.customRequest("scopes", { frameId: 0 });
if (this.all_scopes) {
const variable = this.get_variable(args.expression, null, null, null);
if (variable.error == null) {
try {
const variable = this.get_variable(args.expression, null, null, null);
const parsed_variable = parse_variable(variable.variable);
response.body = {
result: parsed_variable.value,
variablesReference: !is_variable_built_in_type(variable.variable) ? variable.index : 0,
};
} else {
} catch (error) {
response.success = false;
response.message = variable.error;
response.message = error.toString();
}
}
@@ -405,7 +403,6 @@ export class GodotDebugSession extends LoggingDebugSession {
variable: null,
index: null,
object_id: null,
error: null,
};
if (!root) {
@@ -489,8 +486,7 @@ export class GodotDebugSession extends LoggingDebugSession {
(x) => x.sanitized.name === propertyName && x.sanitized.scope_path === path,
)?.real;
if (!result.variable) {
result.error = `Could not find: ${propertyName}`;
return result;
throw new Error(`Could not find: ${propertyName}`);
}
if (root.value.entries) {

View File

@@ -25,7 +25,6 @@ interface Variable {
variable: GodotVariable;
index: number;
object_id: number;
error: string;
}
export class GodotDebugSession extends LoggingDebugSession {
@@ -126,17 +125,16 @@ export class GodotDebugSession extends LoggingDebugSession {
await debug.activeDebugSession.customRequest("scopes", { frameId: 0 });
if (this.all_scopes) {
const variable = this.get_variable(args.expression, null, null, null);
if (variable.error == null) {
try {
const variable = this.get_variable(args.expression, null, null, null);
const parsed_variable = parse_variable(variable.variable);
response.body = {
result: parsed_variable.value,
variablesReference: !is_variable_built_in_type(variable.variable) ? variable.index : 0,
};
} else {
} catch (error) {
response.success = false;
response.message = variable.error;
response.message = error.toString();
}
}
@@ -405,7 +403,6 @@ export class GodotDebugSession extends LoggingDebugSession {
variable: null,
index: null,
object_id: null,
error: null,
};
if (!root) {
@@ -489,8 +486,7 @@ export class GodotDebugSession extends LoggingDebugSession {
(x) => x.sanitized.name === propertyName && x.sanitized.scope_path === path,
)?.real;
if (!result.variable) {
result.error = `Could not find: ${propertyName}`;
return result;
throw new Error(`Could not find: ${propertyName}`);
}
if (root.value.entries) {