• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript debugAdapter.Adapter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中vs/workbench/parts/debug/node/debugAdapter.Adapter的典型用法代码示例。如果您正苦于以下问题:TypeScript Adapter类的具体用法?TypeScript Adapter怎么用?TypeScript Adapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: test

	test('merge', () => {

		const da: IRawAdapter = {
			type: 'mock',
			win: {
				runtime: 'winRuntime'
			},
			linux: {
				runtime: 'linuxRuntime'
			},
			osx: {
				runtime: 'osxRuntime'
			},
			runtimeArgs: ['first arg'],
			program: 'mockprogram',
			args: ['arg']
		};

		adapter.merge(da, {
			name: 'my name',
			id: 'my_id',
			version: '1.0',
			publisher: 'mockPublisher',
			isBuiltin: true,
			extensionFolderPath: 'a/b/c/d',
			engines: null
		});

		return adapter.getAdapterExecutable(undefined, false).then(details => {
			assert.equal(details.command, platform.isLinux ? da.linux.runtime : platform.isMacintosh ? da.osx.runtime : da.win.runtime);
			assert.deepEqual(details.args, da.runtimeArgs.concat(['a/b/c/d/mockprogram'].concat(da.args)));
		});
	});
开发者ID:,项目名称:,代码行数:33,代码来源:


示例2: suite

suite('Debug - Adapter', () => {
	let adapter: Adapter;
	const extensionFolderPath = 'a/b/c/';
	const rawAdapter = {
		type: 'mock',
		label: 'Mock Debug',
		enableBreakpointsFor: { 'languageIds': ['markdown'] },
		program: './out/mock/mockDebug.js',
		args: ['arg1', 'arg2'],
		configurationAttributes: {
			launch: {
				required: ['program'],
				properties: {
					program: {
						'type': 'string',
						'description': 'Workspace relative path to a text file.',
						'default': 'readme.md'
					}
				}
			}
		},
		variables: null,
		initialConfigurations: [
			{
				name: 'Mock-Debug',
				type: 'mock',
				request: 'launch',
				program: 'readme.md'
			}
		]
	};

	setup(() => {
		adapter = new Adapter(rawAdapter, { extensionFolderPath, id: 'adapter', name: 'myAdapter', version: '1.0.0', publisher: 'vscode', isBuiltin: false, engines: null },
			null, new TestConfigurationService(), null);
	});

	teardown(() => {
		adapter = null;
	});

	test('attributes', () => {
		assert.equal(adapter.type, rawAdapter.type);
		assert.equal(adapter.label, rawAdapter.label);

		return adapter.getAdapterExecutable(undefined, false).then(details => {
			assert.equal(details.command, paths.join(extensionFolderPath, rawAdapter.program));
			assert.deepEqual(details.args, rawAdapter.args);
		});
	});

	test('schema attributes', () => {
		const schemaAttribute = adapter.getSchemaAttributes()[0];
		assert.notDeepEqual(schemaAttribute, rawAdapter.configurationAttributes);
		Object.keys(rawAdapter.configurationAttributes.launch).forEach(key => {
			assert.deepEqual(schemaAttribute[key], rawAdapter.configurationAttributes.launch[key]);
		});

		assert.equal(schemaAttribute['additionalProperties'], false);
		assert.equal(!!schemaAttribute['properties']['request'], true);
		assert.equal(!!schemaAttribute['properties']['name'], true);
		assert.equal(!!schemaAttribute['properties']['type'], true);
		assert.equal(!!schemaAttribute['properties']['preLaunchTask'], true);
	});

	test('merge', () => {

		const da: IRawAdapter = {
			type: 'mock',
			win: {
				runtime: 'winRuntime'
			},
			linux: {
				runtime: 'linuxRuntime'
			},
			osx: {
				runtime: 'osxRuntime'
			},
			runtimeArgs: ['first arg'],
			program: 'mockprogram',
			args: ['arg']
		};

		adapter.merge(da, {
			name: 'my name',
			id: 'my_id',
			version: '1.0',
			publisher: 'mockPublisher',
			isBuiltin: true,
			extensionFolderPath: 'a/b/c/d',
			engines: null
		});

		return adapter.getAdapterExecutable(undefined, false).then(details => {
			assert.equal(details.command, platform.isLinux ? da.linux.runtime : platform.isMacintosh ? da.osx.runtime : da.win.runtime);
			assert.deepEqual(details.args, da.runtimeArgs.concat(['a/b/c/d/mockprogram'].concat(da.args)));
		});
	});

	test('initial config file content', () => {
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


示例3: suite

suite('Debug - Adapter', () => {
	var adapter: Adapter;
	var extensionFolderPath = 'a/b/c/';
	var rawAdapter = {
		type: 'mock',
		label: 'Mock Debug',
		enableBreakpointsFor: { 'languageIds': [ 'markdown' ] },
		program: './out/mock/mockDebug.js',
		win: {
			runtime: 'winRuntime'
		},
		linux: {
			runtime: 'linuxRuntime'
		},
		osx: {
			runtime: 'osxRuntime'
		},
		configurationAttributes: {
			launch: {
				required: [ 'program' ],
				properties: {
					program: {
						'type': 'string',
						'description': 'Workspace relative path to a text file.',
						'default': 'readme.md'
					}
				}
			}
		},

		initialConfigurations: [
			{
				name: 'Mock-Debug',
				type: 'mock',
				request: 'launch',
				program: 'readme.md'
			}
		]
	}

	setup(() => {
		adapter = new Adapter(rawAdapter, null, { extensionFolderPath, id: 'adapter', name: 'myAdapter', version: '1.0.0', publisher: 'vscode', isBuiltin: false, engines: null });
	});

	teardown(() => {
		adapter = null;
	});

	test('adapter attributes', () => {
		assert.equal(adapter.type, rawAdapter.type);
		assert.equal(adapter.label, rawAdapter.label);
		assert.equal(adapter.program, paths.join(extensionFolderPath, rawAdapter.program));
		assert.equal(adapter.runtime, platform.isLinux ? rawAdapter.linux.runtime : platform.isMacintosh ? rawAdapter.osx.runtime : rawAdapter.win.runtime);
		assert.deepEqual(adapter.initialConfigurations, rawAdapter.initialConfigurations);
	});

	test('schema attributes', () => {
		const schemaAttribute = adapter.getSchemaAttributes()[0];
		assert.notDeepEqual(schemaAttribute, rawAdapter.configurationAttributes);
		Object.keys(rawAdapter.configurationAttributes.launch).forEach(key => {
			assert.deepEqual(schemaAttribute[key], rawAdapter.configurationAttributes.launch[key]);
		});

		assert.equal(schemaAttribute['additionalProperties'], false);
		assert.equal(!!schemaAttribute['properties']['request'], true);
		assert.equal(!!schemaAttribute['properties']['name'], true);
		assert.equal(!!schemaAttribute['properties']['type'], true);
		assert.equal(!!schemaAttribute['properties']['preLaunchTask'], true);
	});
});
开发者ID:JackWangCUMT,项目名称:vscode,代码行数:70,代码来源:debugAdapter.test.ts


示例4:

	test('initial config file content', () => {
		adapter.getInitialConfigurationContent(null).then(content => {
			const expected = ['{',
				'	"version": "0.2.0",',
				'	"configurations": [',
				'		{',
				'			"name": "Mock-Debug",',
				'			"type": "mock",',
				'			"request": "launch",',
				'			"program": "readme.md"',
				'		}',
				'	]',
				'}'].join('\n');
			assert.equal(content, expected);
		}, err => assert.fail());
	});
开发者ID:,项目名称:,代码行数:16,代码来源:


示例5:

	test('merge', () => {
		const runtimeArgs = ['first arg'];
		adapter.merge({
			type: 'mock',
			runtimeArgs,
			program: 'mockprogram'
		}, {
				name: 'my name',
				id: 'my_id',
				version: '1.0',
				publisher: 'mockPublisher',
				isBuiltin: true,
				extensionFolderPath: 'a/b/c/d',
				engines: null
			});

		assert.deepEqual(adapter.runtimeArgs, runtimeArgs);
		assert.equal(adapter.program, 'a/b/c/d/mockprogram');
	});
开发者ID:StateFarmIns,项目名称:vscode,代码行数:19,代码来源:debugAdapter.test.ts


示例6:

	test('initial config file content', () => {

		const expected = ['{',
			'	// Use IntelliSense to learn about possible attributes.',
			'	// Hover to view descriptions of existing attributes.',
			'	// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387',
			'	"version": "0.2.0",',
			'	"configurations": [',
			'		{',
			'			"name": "Mock-Debug",',
			'			"type": "mock",',
			'			"request": "launch",',
			'			"program": "readme.md"',
			'		}',
			'	]',
			'}'].join('\n');

		return adapter.getInitialConfigurationContent().then(content => {
			assert.equal(content, expected);
		}, err => assert.fail());
	});
开发者ID:JarnoNijboer,项目名称:vscode,代码行数:21,代码来源:debugAdapter.test.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript execution.ITerminalService类代码示例发布时间:2022-05-25
下一篇:
TypeScript replHistory.ReplHistory类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap