MCPcopy Create free account
hub / github.com/Marus/cortex-debug / refresh

Method refresh

src/frontend/views/live-watch.ts:247–292  ·  view source on GitHub ↗
(session: vscode.DebugSession)

Source from the content-addressed store, hash-verified

245 }
246
247 public refresh(session: vscode.DebugSession): Promise<void> {
248 return new Promise<void>((resolve) => {
249 this.session = session;
250 if (session !== LiveWatchTreeProvider.session) {
251 resolve();
252 return;
253 }
254 if (this.expr) {
255 const arg: DebugProtocol.EvaluateArguments = {
256 expression: this.expr,
257 context: 'hover'
258 };
259 session.customRequest('liveEvaluate', arg).then((result) => {
260 if (result && result.result !== undefined) {
261 const oldType = this.type;
262 this.value = result.result;
263 this.type = result.type;
264 this.variablesReference = result.variablesReference ?? 0;
265 this.namedVariables = result.namedVariables ?? 0;
266 this.indexedVariables = result.indexedVariables ?? 0;
267 if (oldType !== this.type) {
268 this.children = this.variablesReference ? [] : undefined;
269 }
270 this.refreshChildren(resolve);
271 } else {
272 this.value = `<Failed to evaluate ${this.expr}>`;
273 this.children = undefined;
274 resolve();
275 }
276 }, () => {
277 resolve();
278 });
279 } else if (this.children && !this.parent) {
280 // This is the root node
281 const promises = [];
282 for (const child of this.children) {
283 promises.push(child.refresh(session));
284 }
285 Promise.allSettled(promises).finally(() => {
286 resolve();
287 });
288 } else {
289 this.refreshChildren(resolve);
290 }
291 });
292 }
293
294 public addNewExpr(expr: string): boolean {
295 if (this.parent) {

Callers 1

refreshMethod · 0.45

Calls 2

refreshChildrenMethod · 0.95
customRequestMethod · 0.65

Tested by

no test coverage detected