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


TypeScript URI.revive方法代码示例

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


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

示例1: test

	test('issue #51387: originalFSPath', function () {
		assert.equal(originalFSPath(URI.file('C:\\test')).charAt(0), 'C');
		assert.equal(originalFSPath(URI.file('c:\\test')).charAt(0), 'c');

		assert.equal(originalFSPath(URI.revive(JSON.parse(JSON.stringify(URI.file('C:\\test'))))).charAt(0), 'C');
		assert.equal(originalFSPath(URI.revive(JSON.parse(JSON.stringify(URI.file('c:\\test'))))).charAt(0), 'c');
	});
开发者ID:developers23,项目名称:vscode,代码行数:7,代码来源:extHost.api.impl.test.ts

示例2: test

	test('Opening files from quick open not showing file contents #60163', function () {

		const data = {
			'$mid': 1,
			'fsPath': 'c:\\Users\\bpasero\\Desktop\\Golda\'s Kitchen\\CHANGELOG.md',
			'external': 'file:///c%3A/Users/bpasero/Desktop/Golda%27s%20Kitchen/CHANGELOG.md',
			'path': '/c:/Users/bpasero/Desktop/Golda\'s Kitchen/CHANGELOG.md',
			'scheme': 'file'
		};
		const uri = URI.revive(data);
		assert.equal(uri.scheme, data.scheme);
		assert.equal(uri.path, data.path);
		assert.equal((uri as any)._formatted, null);
		assert.equal((uri as any)._fsPath, null);

		// when the $mid is the current one then we trust
		// the data(no matter what)
		const data2 = {
			'$mid': 100,
			'fsPath': 'c:\\Users\\bpasero\\Desktop\\Golda\'s Kitchen\\CHANGELOG.md',
			'external': 'file:///c%3A/Users/bpasero/Desktop/Golda%27s%20Kitchen/CHANGELOG.md',
			'path': '/c:/Users/bpasero/Desktop/Golda\'s Kitchen/CHANGELOG.md',
			'scheme': 'file'
		};
		const uri2 = URI.revive(data2);
		assert.equal(uri2.scheme, data2.scheme);
		assert.equal(uri2.path, data2.path);
		assert.ok((uri2 as any)._formatted);
		assert.ok((uri2 as any)._fsPath);


	});
开发者ID:DonJayamanne,项目名称:vscode,代码行数:32,代码来源:uri.test.ts

示例3: call

	call(_: unknown, command: string, arg?: any): Promise<any> {
		switch (command) {
			case 'createUntitledWorkspace': {
				const rawFolders: IWorkspaceFolderCreationData[] = arg[0];
				const remoteAuthority: string = arg[1];
				let folders: IWorkspaceFolderCreationData[] | undefined = undefined;
				if (Array.isArray(rawFolders)) {
					folders = rawFolders.map(rawFolder => {
						return {
							uri: URI.revive(rawFolder.uri), // convert raw URI back to real URI
							name: rawFolder.name
						};
					});
				}

				return this.service.createUntitledWorkspace(folders, remoteAuthority);
			}
			case 'deleteUntitledWorkspace': {
				const w: IWorkspaceIdentifier = arg;
				return this.service.deleteUntitledWorkspace({ id: w.id, configPath: URI.revive(w.configPath) });
			}
			case 'getWorkspaceIdentifier': {
				return this.service.getWorkspaceIdentifier(URI.revive(arg));
			}
		}

		throw new Error(`Call not found: ${command}`);
	}
开发者ID:PKRoma,项目名称:vscode,代码行数:28,代码来源:workspacesIpc.ts

示例4: reviveUris

	private reviveUris() {
		if (this.configuration.folderUri) {
			this.configuration.folderUri = URI.revive(this.configuration.folderUri);
		}

		if (this.configuration.workspace) {
			this.configuration.workspace = reviveWorkspaceIdentifier(this.configuration.workspace);
		}

		const filesToWait = this.configuration.filesToWait;
		const filesToWaitPaths = filesToWait && filesToWait.paths;
		[filesToWaitPaths, this.configuration.filesToOpenOrCreate, this.configuration.filesToDiff].forEach(paths => {
			if (Array.isArray(paths)) {
				paths.forEach(path => {
					if (path.fileUri) {
						path.fileUri = URI.revive(path.fileUri);
					}
				});
			}
		});

		if (filesToWait) {
			filesToWait.waitMarkerFileUri = URI.revive(filesToWait.waitMarkerFileUri);
		}
	}
开发者ID:PKRoma,项目名称:vscode,代码行数:25,代码来源:main.ts

示例5: if

				urisToOpen.forEach(r => {
					if (isWorkspaceToOpen(r)) {
						r.workspaceUri = URI.revive(r.workspaceUri);
					} else if (isFolderToOpen(r)) {
						r.folderUri = URI.revive(r.folderUri);
					} else {
						r.fileUri = URI.revive(r.fileUri);
					}
				});
开发者ID:PKRoma,项目名称:vscode,代码行数:9,代码来源:windowsIpc.ts

示例6: call

	call(command: string, args?: any): Thenable<any> {
		switch (command) {
			case 'zip': return this.service.zip(this._transform(args[0]));
			case 'unzip': return this.service.unzip(URI.revive(args[0]), args[1]);
			case 'install': return this.service.install(URI.revive(args[0]));
			case 'installFromGallery': return this.service.installFromGallery(args[0]);
			case 'uninstall': return this.service.uninstall(this._transform(args[0]), args[1]);
			case 'reinstallFromGallery': return this.service.reinstallFromGallery(this._transform(args[0]));
			case 'getInstalled': return this.service.getInstalled(args[0]);
			case 'updateMetadata': return this.service.updateMetadata(this._transform(args[0]), args[1]);
			case 'getExtensionsReport': return this.service.getExtensionsReport();
		}

		throw new Error('Invalid call');
	}
开发者ID:DonJayamanne,项目名称:vscode,代码行数:15,代码来源:extensionManagementIpc.ts

示例7: call

	call(_: unknown, command: string, arg?: any): Promise<any> {
		switch (command) {
			case 'open': return this.service.open(URI.revive(arg));
		}

		throw new Error(`Call not found: ${command}`);
	}
开发者ID:PKRoma,项目名称:vscode,代码行数:7,代码来源:urlIpc.ts

示例8: _getOrCreateWorkspaceStoragePath

	private async _getOrCreateWorkspaceStoragePath(): Promise<string | undefined> {
		if (!this._workspace) {
			return Promise.resolve(undefined);
		}

		if (!this._environment.appSettingsHome) {
			return undefined;
		}
		const storageName = this._workspace.id;
		const storagePath = path.join(this._environment.appSettingsHome.fsPath, 'workspaceStorage', storageName);

		const exists = await pfs.dirExists(storagePath);

		if (exists) {
			return storagePath;
		}

		try {
			await pfs.mkdirp(storagePath);
			await pfs.writeFile(
				path.join(storagePath, 'meta.json'),
				JSON.stringify({
					id: this._workspace.id,
					configuration: this._workspace.configuration && URI.revive(this._workspace.configuration).toString(),
					name: this._workspace.name
				}, undefined, 2)
			);
			return storagePath;

		} catch (e) {
			console.error(e);
			return undefined;
		}
	}
开发者ID:PKRoma,项目名称:vscode,代码行数:34,代码来源:extHostStoragePaths.ts

示例9: call

	call(context, command: string, args?: any): Thenable<any> {
		const uriTransformer = this.getUriTransformer(context);
		switch (command) {
			case 'zip': return this.service.zip(this._transformIncoming(args[0], uriTransformer)).then(uri => uriTransformer.transformOutgoing(uri));
			case 'unzip': return this.service.unzip(URI.revive(uriTransformer.transformIncoming(args[0])), args[1]);
			case 'install': return this.service.install(URI.revive(uriTransformer.transformIncoming(args[0])));
			case 'installFromGallery': return this.service.installFromGallery(args[0]);
			case 'uninstall': return this.service.uninstall(this._transformIncoming(args[0], uriTransformer), args[1]);
			case 'reinstallFromGallery': return this.service.reinstallFromGallery(this._transformIncoming(args[0], uriTransformer));
			case 'getInstalled': return this.service.getInstalled(args[0]).then(extensions => extensions.map(e => this._transformOutgoing(e, uriTransformer)));
			case 'updateMetadata': return this.service.updateMetadata(this._transformIncoming(args[0], uriTransformer), args[1]).then(e => this._transformOutgoing(e, uriTransformer));
			case 'getExtensionsReport': return this.service.getExtensionsReport();
		}

		throw new Error('Invalid call');
	}
开发者ID:donaldpipowitch,项目名称:vscode,代码行数:16,代码来源:extensionManagementIpc.ts


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