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


TypeScript uri.parse函数代码示例

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


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

示例1: appendEditorTitleContextMenuItem

appendEditorTitleContextMenuItem(COPY_PATH_COMMAND_ID, CopyPathAction.LABEL, ResourceContextKey.IsFile);
appendEditorTitleContextMenuItem(REVEAL_IN_EXPLORER_COMMAND_ID, nls.localize('revealInSideBar', "Reveal in Side Bar"), ResourceContextKey.IsFile);

function appendEditorTitleContextMenuItem(id: string, title: string, when: ContextKeyExpr): void {

	// Menu
	MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, {
		command: { id, title },
		when,
		group: '2_files'
	});
}

// Editor Title Menu for Conflict Resolution
appendSaveConflictEditorTitleAction('workbench.files.action.acceptLocalChanges', nls.localize('acceptLocalChanges', "Use your changes and overwrite disk contents"), {
	light: URI.parse(require.toUrl(`vs/workbench/parts/files/electron-browser/media/check.svg`)).fsPath,
	dark: URI.parse(require.toUrl(`vs/workbench/parts/files/electron-browser/media/check-inverse.svg`)).fsPath
}, -10, acceptLocalChangesCommand);
appendSaveConflictEditorTitleAction('workbench.files.action.revertLocalChanges', nls.localize('revertLocalChanges', "Discard your changes and revert to content on disk"), {
	light: URI.parse(require.toUrl(`vs/workbench/parts/files/electron-browser/media/undo.svg`)).fsPath,
	dark: URI.parse(require.toUrl(`vs/workbench/parts/files/electron-browser/media/undo-inverse.svg`)).fsPath
}, -9, revertLocalChangesCommand);

function appendSaveConflictEditorTitleAction(id: string, title: string, iconPath: { dark: string; light?: string; }, order: number, command: ICommandHandler): void {

	// Command
	CommandsRegistry.registerCommand(id, command);

	// Action
	MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
		command: { id, title, iconPath },
开发者ID:AllureFer,项目名称:vscode,代码行数:31,代码来源:fileActions.contribution.ts

示例2: test

	test('ResourceMap - basics', function () {
		const map = new ResourceMap<any>();

		const resource1 = URI.parse('some://1');
		const resource2 = URI.parse('some://2');
		const resource3 = URI.parse('some://3');
		const resource4 = URI.parse('some://4');
		const resource5 = URI.parse('some://5');
		const resource6 = URI.parse('some://6');

		assert.equal(map.size, 0);

		map.set(resource1, 1);
		map.set(resource2, '2');
		map.set(resource3, true);

		const values = map.values();
		assert.equal(values[0], 1);
		assert.equal(values[1], '2');
		assert.equal(values[2], true);

		let counter = 0;
		map.forEach(value => {
			assert.equal(value, values[counter++]);
		});

		const obj = Object.create(null);
		map.set(resource4, obj);

		const date = Date.now();
		map.set(resource5, date);

		assert.equal(map.size, 5);
		assert.equal(map.get(resource1), 1);
		assert.equal(map.get(resource2), '2');
		assert.equal(map.get(resource3), true);
		assert.equal(map.get(resource4), obj);
		assert.equal(map.get(resource5), date);
		assert.ok(!map.get(resource6));

		map.delete(resource6);
		assert.equal(map.size, 5);
		assert.ok(map.delete(resource1));
		assert.ok(map.delete(resource2));
		assert.ok(map.delete(resource3));
		assert.ok(map.delete(resource4));
		assert.ok(map.delete(resource5));

		assert.equal(map.size, 0);
		assert.ok(!map.get(resource5));
		assert.ok(!map.get(resource4));
		assert.ok(!map.get(resource3));
		assert.ok(!map.get(resource2));
		assert.ok(!map.get(resource1));

		map.set(resource1, 1);
		map.set(resource2, '2');
		map.set(resource3, true);

		assert.ok(map.has(resource1));
		assert.equal(map.get(resource1), 1);
		assert.equal(map.get(resource2), '2');
		assert.equal(map.get(resource3), true);

		map.clear();

		assert.equal(map.size, 0);
		assert.ok(!map.get(resource1));
		assert.ok(!map.get(resource2));
		assert.ok(!map.get(resource3));
		assert.ok(!map.has(resource1));

		map.set(resource1, false);
		map.set(resource2, 0);

		assert.ok(map.has(resource1));
		assert.ok(map.has(resource2));
	});
开发者ID:jumpinjackie,项目名称:sqlopsstudio,代码行数:78,代码来源:map.test.ts

示例3: test

	test('URI#fsPath - no `fsPath` when no `path`', () => {
		const value = URI.parse('file://%2Fhome%2Fticino%2Fdesktop%2Fcpluscplus%2Ftest.cpp');
		assert.equal(value.authority, '/home/ticino/desktop/cpluscplus/test.cpp');
		assert.equal(value.path, '');
		assert.equal(value.fsPath, '');
	});
开发者ID:m-khosravi,项目名称:vscode,代码行数:6,代码来源:uri.test.ts

示例4:

	checksums: { [path: string]: string; };
	checksumFailMoreInfoUrl: string;
	hockeyApp: {
		'win32-ia32': string;
		'win32-x64': string;
		'linux-ia32': string;
		'linux-x64': string;
		'darwin': string;
	};
}

export interface ISurveyData {
	surveyId: string;
	surveyUrl: string;
	languageId: string;
	editCount: number;
	userProbability: number;
}

const rootPath = path.dirname(uri.parse(require.toUrl('')).fsPath);
const productJsonPath = path.join(rootPath, 'product.json');
const product = require.__$__nodeRequire(productJsonPath) as IProductConfiguration;

if (process.env['VSCODE_DEV']) {
	product.nameShort += ' Dev';
	product.nameLong += ' Dev';
	product.dataFolderName += '-dev';
}

export default product;
开发者ID:SeanKilleen,项目名称:vscode,代码行数:30,代码来源:product.ts

示例5: createTestMirrorModelFromString

		assert.throws(() => {
			service.insert(URI.parse('test://path/some-N1ce-name'), createTestMirrorModelFromString('hello again'));
		});
开发者ID:GYGit,项目名称:vscode,代码行数:3,代码来源:resourceService.test.ts

示例6:

		assert.throws(() => URI.parse('file:////shares/files/p.cs'));
开发者ID:m-khosravi,项目名称:vscode,代码行数:1,代码来源:uri.test.ts

示例7:

		assert.throws(() => collection.delete(URI.parse('aa:bb')));
开发者ID:JarnoNijboer,项目名称:vscode,代码行数:1,代码来源:extHostDiagnostics.test.ts

示例8: _spawnSharedProcess

import URI from 'vs/base/common/uri';
import { IDisposable } from 'vs/base/common/lifecycle';
import { assign } from 'vs/base/common/objects';
import { ParsedArgs } from 'vs/platform/environment/common/environment';
import { TPromise } from 'vs/base/common/winjs.base';

export interface ISharedProcessInitData {
	args: ParsedArgs;
}

export interface ISharedProcessOptions {
	allowOutput?: boolean;
	debugPort?: number;
}

const boostrapPath = URI.parse(require.toUrl('bootstrap')).fsPath;

function _spawnSharedProcess(initData: ISharedProcessInitData, options: ISharedProcessOptions): cp.ChildProcess {
	const execArgv = [];
	const env = assign({}, process.env, {
		AMD_ENTRYPOINT: 'vs/code/node/sharedProcessMain',
		ELECTRON_NO_ASAR: '1'
	});

	if (options.allowOutput) {
		env['VSCODE_ALLOW_IO'] = 'true';
	}

	if (options.debugPort) {
		execArgv.push(`--debug=${options.debugPort}`);
	}
开发者ID:,项目名称:,代码行数:31,代码来源:


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