MCPcopy Index your code
hub / github.com/microsoft/vscode-js-debug / scopes

Method scopes

src/adapter/stackTrace.ts:464–547  ·  view source on GitHub ↗

@inheritdoc

()

Source from the content-addressed store, hash-verified

462
463 /** @inheritdoc */
464 async scopes(): Promise<Dap.ScopesResult> {
465 const currentScope = this._scope;
466 if (!currentScope) {
467 throw new ProtocolError(asyncScopesNotAvailable());
468 }
469
470 const scopes = await Promise.all(
471 currentScope.chain.map(async (scope, scopeNumber) => {
472 let name = '';
473 let presentationHint: 'arguments' | 'locals' | 'registers' | undefined;
474 switch (scope.type) {
475 case 'global':
476 name = l10n.t('Global');
477 break;
478 case 'local':
479 name = l10n.t('Local');
480 presentationHint = 'locals';
481 break;
482 case 'with':
483 name = l10n.t('With Block');
484 presentationHint = 'locals';
485 break;
486 case 'closure':
487 name = l10n.t('Closure');
488 presentationHint = 'arguments';
489 break;
490 case 'catch':
491 name = l10n.t('Catch Block');
492 presentationHint = 'locals';
493 break;
494 case 'block':
495 name = l10n.t('Block');
496 presentationHint = 'locals';
497 break;
498 case 'script':
499 name = l10n.t('Script');
500 break;
501 case 'eval':
502 name = l10n.t('Eval');
503 break;
504 case 'module':
505 name = l10n.t('Module');
506 break;
507 default:
508 // fallback for custom scope types from other runtimes (#651)
509 name = scope.type.substr(0, 1).toUpperCase() + scope.type.substr(1);
510 break;
511 }
512 if (scope.name && scope.type === 'closure') {
513 name = l10n.t('Closure ({0})', scope.name);
514 } else if (scope.name) {
515 name = `${name}: ${scope.name}`;
516 }
517
518 const variable = this._scopeVariable(scopeNumber, currentScope);
519 if (!variable) {
520 return undefined;
521 }

Callers

nothing calls this directly

Calls 8

_scopeVariableMethod · 0.95
asyncScopesNotAvailableFunction · 0.90
allMethod · 0.80
mapMethod · 0.80
rawLocationMethod · 0.80
toDapMethod · 0.65
filterMethod · 0.45

Tested by

no test coverage detected