1、删除变量名中static;

2、解决static引起的成员变量解析失败
This commit is contained in:
xuhong 2024-06-28 16:32:20 +08:00
parent 7237e81862
commit ce7e31dc9f
2 changed files with 19 additions and 1 deletions

View File

@ -282,6 +282,12 @@ export function expandValue(variableCreate: Function, value: string, root: strin
if (name.charAt(name.length - 1) === ">") {
name = name.slice(0, -1);
}
let tmpName = name.split(" ");
if(tmpName.length>1 && !name.includes("anonymous union")){
name = tmpName[tmpName.length-1];
}
//JSON.parse()
if (pushToStack){
stack.push(variable);
@ -321,6 +327,14 @@ export function expandValue(variableCreate: Function, value: string, root: strin
val = "...";
} else {
evaluateName = getNamespace(name);
if(typeof evaluateName == "string" && evaluateName.includes("static ")) {
evaluateName = evaluateName.replace("static ", "");
}
let tmpName = evaluateName.split(' ');
if(tmpName.length>1){
evaluateName = tmpName[tmpName.length-1];
}
}
value = value.trim();

View File

@ -505,7 +505,11 @@ export class MI2DebugSession extends DebugSession {
protected async variablesRequest(response: DebugProtocol.VariablesResponse, args: DebugProtocol.VariablesArguments): Promise<void> {
const variables: DebugProtocol.Variable[] = [];
const id: VariableScope | string | VariableObject | ExtendedVariable = this.variableHandles.get(args.variablesReference);
let id: VariableScope | string | VariableObject | ExtendedVariable = this.variableHandles.get(args.variablesReference);
if(typeof id == "string" && id.includes("static ")) {
id = id.replace("static ", "");
}
const createVariable = (arg: string | VariableObject, options?: any) => {
if (options)
return this.variableHandles.create(new ExtendedVariable(typeof arg === 'string' ? arg : arg.name, options));