!5 解决static对象成员变量解析失败问题

Merge pull request !5 from 黑熊怪/staticbr
This commit is contained in:
黑熊怪 2024-06-28 08:38:33 +00:00 committed by Gitee
commit 516477f13d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
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));