本文整理匯總了TypeScript中vscode-debugadapter.Handles類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Handles類的具體用法?TypeScript Handles怎麽用?TypeScript Handles使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Handles類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: variablesRequest
protected variablesRequest(response: DebugProtocol.VariablesResponse, args: DebugProtocol.VariablesArguments): void {
log('VariablesRequest');
let vari = this._variableHandles.get(args.variablesReference);
let variables;
if (vari.kind === GoReflectKind.Array || vari.kind === GoReflectKind.Slice || vari.kind === GoReflectKind.Map) {
variables = vari.children.map((v, i) => {
let { result, variablesReference} = this.convertDebugVariableToProtocolVariable(v, i);
return {
name: '[' + i + ']',
value: result,
variablesReference
};
});
} else {
variables = vari.children.map((v, i) => {
let { result, variablesReference} = this.convertDebugVariableToProtocolVariable(v, i);
return {
name: v.name,
value: result,
variablesReference
};
});
}
log(JSON.stringify(variables, null, ' '));
response.body = { variables };
this.sendResponse(response);
log('VariablesResponse');
}
示例2: logError
this.delve.call<DebugVariable[]>('ListFunctionArgs', [{ goroutineID: this.debugState.currentGoroutine.id, frame: args.frameId }], (err, args) => {
if (err) {
logError('Failed to list function args.');
return this.sendErrorResponse(response, 2006, 'Unable to list args: "{e}"', { e: err.toString() });
}
log(args);
let vars = args.concat(locals);
let scopes = new Array<Scope>();
let localVariables = {
name: 'Local',
addr: 0,
type: '',
realType: '',
kind: 0,
value: '',
len: 0,
cap: 0,
children: vars,
unreadable: ''
};
scopes.push(new Scope('Local', this._variableHandles.create(localVariables), false));
response.body = { scopes };
this.sendResponse(response);
log('ScopesResponse');
});
示例3: convertDebugVariableToProtocolVariable
private convertDebugVariableToProtocolVariable(v: DebugVariable, i: number): { result: string; variablesReference: number; } {
if (v.kind === GoReflectKind.Ptr || v.kind === GoReflectKind.UnsafePointer) {
if (v.children[0].addr === 0) {
return {
result: 'nil <' + v.type + '>',
variablesReference: 0
};
} else if (v.children[0].type === 'void') {
return {
result: 'void',
variablesReference: 0
};
} else {
return {
result: '<' + v.type + '>',
variablesReference: v.children[0].children.length > 0 ? this._variableHandles.create(v.children[0]) : 0
};
}
} else if (v.kind === GoReflectKind.Slice) {
return {
result: '<' + v.type + '> (length: ' + v.len + ', cap: ' + v.cap + ')',
variablesReference: this._variableHandles.create(v)
};
} else if (v.kind === GoReflectKind.Array) {
return {
result: '<' + v.type + '>',
variablesReference: this._variableHandles.create(v)
};
} else if (v.kind === GoReflectKind.String) {
return {
result: v.unreadable ? ('<' + v.unreadable + '>') : ('"' + v.value + '"'),
variablesReference: 0
};
} else {
return {
result: v.value || ('<' + v.type + '>'),
variablesReference: v.children.length > 0 ? this._variableHandles.create(v) : 0
};
}
}