当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript DebugClient.scopesRequest方法代码示例

本文整理汇总了TypeScript中vscode-debugadapter-testsupport.DebugClient.scopesRequest方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DebugClient.scopesRequest方法的具体用法?TypeScript DebugClient.scopesRequest怎么用?TypeScript DebugClient.scopesRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vscode-debugadapter-testsupport.DebugClient的用法示例。


在下文中一共展示了DebugClient.scopesRequest方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

	it('should add a condition to an already set breakpoint', async function() {

		await util.receivePageLoadedEvent(dc);

		let sourcePath = path.join(TESTDATA_PATH, 'web/main.js');
		await util.setBreakpoints(dc, sourcePath, [ { line: 24 } ]);

		let stoppedEvent = await util.runCommandAndReceiveStoppedEvent(dc, 
			() => util.evaluate(dc, 'factorial(5)')
		);

		let threadId = stoppedEvent.body.threadId!;
		let stackTrace = await dc.stackTraceRequest({ threadId });
		let scopes = await dc.scopesRequest({ frameId: stackTrace.body.stackFrames[0].id });

		let variablesResponse = await dc.variablesRequest({ variablesReference: scopes.body.scopes[0].variablesReference });
		let variables = variablesResponse.body.variables;
		assert.equal(util.findVariable(variables, 'n').value, '5');

		await util.setBreakpoints(dc, sourcePath, [ { line: 24, condition: 'n === 2' } ]);
		await dc.continueRequest({ threadId });

		await util.runCommandAndReceiveStoppedEvent(dc, 
			() => util.evaluate(dc, 'factorial(5)')
		);

		stackTrace = await dc.stackTraceRequest({ threadId });
		scopes = await dc.scopesRequest({ frameId: stackTrace.body.stackFrames[0].id });

		variablesResponse = await dc.variablesRequest({ variablesReference: scopes.body.scopes[0].variablesReference });
		variables = variablesResponse.body.variables;
		assert.equal(util.findVariable(variables, 'n').value, '2');
	});
开发者ID:hbenl,项目名称:vscode-firefox-debug,代码行数:33,代码来源:testSetBreakpoints.ts

示例2: assert

 dc.waitForEvent('stopped').then(async (response1) => {
     let response2 = await dc.stackTraceRequest({ threadId: response1.body.threadId, startFrame: 20, levels: 10 });
     assert(response2.body.stackFrames.length == 10)
     let response3 = await dc.scopesRequest({ frameId: response2.body.stackFrames[0].id });
     let response4 = await dc.variablesRequest({ variablesReference: response3.body.scopes[0].variablesReference });
     assert(response4.body.variables[0].name == 'levelsToGo');
     assert(response4.body.variables[0].value == '20');
 }),
开发者ID:magpier84,项目名称:vscode-lldb,代码行数:8,代码来源:adapter.test.ts

示例3: startAndGetProperties

	async function startAndGetProperties(dc: DebugClient, bpLine: number, trigger: string): Promise<DebugProtocol.Variable[]> {

		await util.setBreakpoints(dc, SOURCE_PATH, [ bpLine ]);
	
		util.evaluate(dc, trigger);
		let stoppedEvent = await util.receiveStoppedEvent(dc);
		let stackTrace = await dc.stackTraceRequest({ threadId: stoppedEvent.body.threadId! });
		let scopes = await dc.scopesRequest({ frameId: stackTrace.body.stackFrames[0].id });
	
		let variablesResponse = await dc.variablesRequest({ variablesReference: scopes.body.scopes[0].variablesReference });
		let variable = util.findVariable(variablesResponse.body.variables, 'x');
		let propertiesResponse = await dc.variablesRequest({ variablesReference: variable.variablesReference });
		return propertiesResponse.body.variables;
	}
开发者ID:hbenl,项目名称:vscode-firefox-debug,代码行数:14,代码来源:testAccessorProperties.ts

示例4: it

	it('should inspect variables in different stackframes', async function() {

		let sourcePath = path.join(TESTDATA_PATH, 'web/main.js');
		await util.setBreakpoints(dc, sourcePath, [ 25 ]);

		util.evaluateDelayed(dc, 'factorial(4)', 0);
		let stoppedEvent = await util.receiveStoppedEvent(dc);
		let stackTrace = await dc.stackTraceRequest({ threadId: stoppedEvent.body.threadId! });

		for (let i = 0; i < 4; i++) {
			let scopes = await dc.scopesRequest({ frameId: stackTrace.body.stackFrames[i].id });
			let variables = await dc.variablesRequest({ variablesReference: scopes.body.scopes[0].variablesReference });
			assert.equal(util.findVariable(variables.body.variables, 'n').value, i + 1);
		}
	});
开发者ID:hbenl,项目名称:vscode-firefox-debug,代码行数:15,代码来源:testInspectVariables.ts

示例5: beforeEach

 beforeEach(async () => {
     await Promise.all([
         client.launch({program}),
         client.waitForEvent('initialized')
     ]);
     await client.setBreakpointsRequest({source: {path: program}, breakpoints: [{line: 17}]});
     const [, event] = await Promise.all([
         client.configurationDoneRequest(),
         client.waitForEvent('stopped') as Promise<DebugProtocol.StoppedEvent>
     ]);
     const stackFrame = (await client.stackTraceRequest({threadId: event.body.threadId})).body.stackFrames[0];
     const scopes = (await client.scopesRequest({frameId: stackFrame.id})).body.scopes;
     localScope = scopes.find(scope => scope.name === 'Locals');
     superglobalsScope = scopes.find(scope => scope.name === 'Superglobals');
     constantsScope = scopes.find(scope => scope.name === 'User defined constants');
 });
开发者ID:VivPat,项目名称:vscode-php-debug,代码行数:16,代码来源:adapter.ts

示例6: it

	it('should skip a breakpoint until its hit count is reached', async function() {

		let sourcePath = path.join(TESTDATA_PATH, 'web/main.js');
		await util.setBreakpoints(dc, sourcePath, [ { line: 24, hitCondition: '4' } ]);

		let stoppedEvent = await util.runCommandAndReceiveStoppedEvent(dc, 
			() => util.evaluate(dc, 'factorial(5)')
		);

		let threadId = stoppedEvent.body.threadId!;
		let stackTrace = await dc.stackTraceRequest({ threadId });
		let scopes = await dc.scopesRequest({ frameId: stackTrace.body.stackFrames[0].id });

		let variablesResponse = await dc.variablesRequest({ variablesReference: scopes.body.scopes[0].variablesReference });
		let variables = variablesResponse.body.variables;
		assert.equal(util.findVariable(variables, 'n').value, '2');
	});
开发者ID:hbenl,项目名称:vscode-firefox-debug,代码行数:17,代码来源:testHitBreakpoints.ts

示例7: function

	it.skip('should inspect return values on stepping out of recursive functions', async function() {

		let sourcePath = path.join(TESTDATA_PATH, 'web/main.js');
		await util.setBreakpoints(dc, sourcePath, [ 25 ]);

		util.evaluate(dc, 'factorial(4)');
		let stoppedEvent = await util.receiveStoppedEvent(dc);
		let threadId = stoppedEvent.body.threadId!;

		for (let i = 0; i < 4; i++) {
			await dc.stepOutRequest({ threadId });
			await util.receiveStoppedEvent(dc);
			let stackTrace = await dc.stackTraceRequest({ threadId: stoppedEvent.body.threadId! });
			let scopes = await dc.scopesRequest({ frameId: stackTrace.body.stackFrames[0].id });
			let variables = await dc.variablesRequest({ variablesReference: scopes.body.scopes[0].variablesReference });
			assert.equal(util.findVariable(variables.body.variables, 'Return value').value, factorial(i + 1));
		}
	});
开发者ID:hbenl,项目名称:vscode-firefox-debug,代码行数:18,代码来源:testInspectVariables.ts

示例8: getErrorScope

 async function getErrorScope(): Promise<{name: string, type?: string, message?: string, code?: string}> {
     const frameId = (await client.stackTraceRequest({threadId})).body.stackFrames[0].id;
     const errorScope = (await client.scopesRequest({frameId})).body.scopes[0];
     const variables = (await client.variablesRequest({variablesReference: errorScope.variablesReference})).body.variables;
     const errorInfo: {name: string, type?: string, message?: string, code?: string} = {name: errorScope.name};
     const type = variables.find(variable => variable.name === 'type');
     if (type) {
         errorInfo.type = type.value;
     }
     const message = variables.find(variable => variable.name === 'message');
     if (message) {
         errorInfo.message = message.value;
     }
     const code = variables.find(variable => variable.name === 'code');
     if (code) {
         errorInfo.code = code.value;
     }
     return errorInfo;
 }
开发者ID:VivPat,项目名称:vscode-php-debug,代码行数:19,代码来源:adapter.ts


注:本文中的vscode-debugadapter-testsupport.DebugClient.scopesRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。