()
| 185 | } |
| 186 | |
| 187 | async scopes(): Promise<Dap.ScopesResult> { |
| 188 | if (!this._scope) { |
| 189 | throw new ProtocolError(asyncScopesNotAvailable()); |
| 190 | } |
| 191 | |
| 192 | const scopes: Dap.Scope[] = []; |
| 193 | for (let scopeNumber = 0; scopeNumber < this._scope.chain.length; scopeNumber++) { |
| 194 | const scope: Cdp.Debugger.Scope = this._scope.chain[scopeNumber]; |
| 195 | |
| 196 | let name = ''; |
| 197 | let presentationHint: 'arguments' | 'locals' | 'registers' | undefined; |
| 198 | switch (scope.type) { |
| 199 | case 'global': |
| 200 | name = localize('scope.global', 'Global'); |
| 201 | break; |
| 202 | case 'local': |
| 203 | name = localize('scope.local', 'Local'); |
| 204 | presentationHint = 'locals'; |
| 205 | break; |
| 206 | case 'with': |
| 207 | name = localize('scope.with', 'With Block'); |
| 208 | presentationHint = 'locals'; |
| 209 | break; |
| 210 | case 'closure': |
| 211 | name = localize('scope.closure', 'Closure'); |
| 212 | presentationHint = 'arguments'; |
| 213 | break; |
| 214 | case 'catch': |
| 215 | name = localize('scope.catch', 'Catch Block'); |
| 216 | presentationHint = 'locals'; |
| 217 | break; |
| 218 | case 'block': |
| 219 | name = localize('scope.block', 'Block'); |
| 220 | presentationHint = 'locals'; |
| 221 | break; |
| 222 | case 'script': |
| 223 | name = localize('scope.script', 'Script'); |
| 224 | break; |
| 225 | case 'eval': |
| 226 | name = localize('scope.eval', 'Eval'); |
| 227 | break; |
| 228 | case 'module': |
| 229 | name = localize('scope.module', 'Module'); |
| 230 | break; |
| 231 | } |
| 232 | if (scope.name && scope.type === 'closure') { |
| 233 | name = localize('scope.closureNamed', 'Closure ({0})', scope.name); |
| 234 | } else if (scope.name) { |
| 235 | name = `${name}: ${scope.name}`; |
| 236 | } |
| 237 | |
| 238 | const variable = await this._scopeVariable(scopeNumber, this._scope); |
| 239 | const dap: Dap.Scope = { |
| 240 | name, |
| 241 | presentationHint, |
| 242 | expensive: scope.type === 'global', |
| 243 | namedVariables: variable.namedVariables, |
| 244 | indexedVariables: variable.indexedVariables, |
nothing calls this directly
no test coverage detected