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


TypeScript debugAdapter.Adapter类代码示例

本文整理汇总了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;未经允许,请勿转载。