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

TypeScript workspace.IWorkspaceContextService类代码示例

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

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



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

示例1: getRootPath

export function getRootPath(contextService: IWorkspaceContextService): string {
	let isWorkspace = contextService.getWorkbenchState() === WorkbenchState.WORKSPACE;
	if (isWorkspace) {
		return contextService.getWorkspace().folders[0].uri.fsPath;
	}

	return undefined;
}
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:8,代码来源:pathUtilities.ts


示例2: revealResourcesInOS

function revealResourcesInOS(resources: URI[], windowsService: IWindowsService, notificationService: INotificationService, workspaceContextService: IWorkspaceContextService): void {
	if (resources.length) {
		sequence(resources.map(r => () => windowsService.showItemInFolder(paths.normalize(r.fsPath, true))));
	} else if (workspaceContextService.getWorkspace().folders.length) {
		windowsService.showItemInFolder(paths.normalize(workspaceContextService.getWorkspace().folders[0].uri.fsPath, true));
	} else {
		notificationService.info(nls.localize('openFileToReveal', "Open a file first to reveal"));
	}
}
开发者ID:jinlongchen2018,项目名称:vscode,代码行数:9,代码来源:fileCommands.ts


示例3: defaultWorkspacePath

export function defaultWorkspacePath(contextService: IWorkspaceContextService, historyService: IHistoryService, environmentService: IEnvironmentService): string {

	// Check for current workspace config file first...
	if (contextService.getWorkbenchState() === WorkbenchState.WORKSPACE && !isUntitledWorkspace(contextService.getWorkspace().configuration.fsPath, environmentService)) {
		return dirname(contextService.getWorkspace().configuration.fsPath);
	}

	// ...then fallback to default folder path
	return defaultFolderPath(contextService, historyService);
}
开发者ID:JarnoNijboer,项目名称:vscode,代码行数:10,代码来源:workspaceCommands.ts


示例4: loadExperiments

export function loadExperiments(contextService: IWorkspaceContextService, storageService: IStorageService, configurationService: IConfigurationService): ITelemetryExperiments {

	const key = 'experiments.randomness';
	let valueString = storageService.get(key);
	if (!valueString) {
		valueString = Math.random().toString();
		storageService.store(key, valueString);
	}

	const random1 = parseFloat(valueString);
	let [random2, showNewUserWatermark] = splitRandom(random1);
	let [random3, openUntitledFile] = splitRandom(random2);
	let [, openGettingStarted] = splitRandom(random3);

	const newUserDuration = 24 * 60 * 60 * 1000;
	const firstSessionDate = storageService.get('telemetry.firstSessionDate');
	const isNewUser = !firstSessionDate || Date.now() - Date.parse(firstSessionDate) < newUserDuration;
	if (!isNewUser || contextService.hasWorkspace()) {
		showNewUserWatermark = defaultExperiments.showNewUserWatermark;
		openUntitledFile = defaultExperiments.openUntitledFile;
	}

	const isNewSession = !storageService.get('telemetry.lastSessionDate');
	const now = Date.now();
	if (!(isNewSession && now >= beginGettingStartedExp && now < endGettingStartedExp)) {
		openGettingStarted = undefined;
	}

	return applyOverrides(configurationService, {
		showNewUserWatermark,
		openUntitledFile,
		openGettingStarted
	});
}
开发者ID:StateFarmIns,项目名称:vscode,代码行数:34,代码来源:telemetry.ts


示例5: constructor

	// Optional workspaceRoot there to be used in tests.
	constructor(
		private editorService: IWorkbenchEditorService,
		contextService: IWorkspaceContextService,
		environmentService: IEnvironmentService,
		workspaceRoot: URI = null,
		envVariables: { [key: string]: string } = process.env
	) {
		super();
		let fsPath = '';
		if (workspaceRoot || (contextService && contextService.getWorkspace())) {
			fsPath = workspaceRoot ? workspaceRoot.fsPath : contextService.getWorkspace().resource.fsPath;
		}
		this._workspaceRoot = Paths.normalize(fsPath, true);
		this._execPath = environmentService.execPath;
		Object.keys(envVariables).forEach(key => {
			this[`env.${key}`] = envVariables[key];
		});
	}
开发者ID:GYGit,项目名称:vscode,代码行数:19,代码来源:systemVariables.ts


示例6: getSettingsTargetName

export function getSettingsTargetName(target: ConfigurationTarget, resource: URI, workspaceContextService: IWorkspaceContextService): string {
	switch (target) {
		case ConfigurationTarget.USER:
			return localize('userSettingsTarget', "User Settings");
		case ConfigurationTarget.WORKSPACE:
			return localize('workspaceSettingsTarget', "Workspace Settings");
		case ConfigurationTarget.FOLDER:
			const root = workspaceContextService.getRoot(resource);
			return root ? paths.basename(root.fsPath) : '';
	}
}
开发者ID:armanio123,项目名称:vscode,代码行数:11,代码来源:preferences.ts


示例7: startWatching

	public startWatching(): () => void {
		if (this.contextService.getWorkspace().folders[0].uri.scheme !== Schemas.file) {
			return () => { };
		}
		let basePath: string = normalize(this.contextService.getWorkspace().folders[0].uri.fsPath);

		if (basePath && basePath.indexOf('\\\\') === 0 && endsWith(basePath, sep)) {
			// for some weird reason, node adds a trailing slash to UNC paths
			// we never ever want trailing slashes as our base path unless
			// someone opens root ("/").
			// See also https://github.com/nodejs/io.js/issues/1765
			basePath = rtrim(basePath, sep);
		}

		const watcher = new OutOfProcessWin32FolderWatcher(
			basePath,
			this.ignored,
			events => this.onRawFileEvents(events),
			error => this.onError(error),
			this.verboseLogging
		);

		return () => {
			this.isDisposed = true;
			watcher.dispose();
		};
	}
开发者ID:DonJayamanne,项目名称:vscode,代码行数:27,代码来源:watcherService.ts


示例8: registerListeners

	private registerListeners(): void {

		// Workspace Folder Change
		this._register(this.contextService.onDidChangeWorkspaceFolders(() => {
			this.encodingOverride = this.getEncodingOverrides();
		}));
	}
开发者ID:joelday,项目名称:vscode,代码行数:7,代码来源:encoding.ts


示例9: confirm

	public confirm(confirmation: IConfirmation): boolean {
		if (!confirmation.primaryButton) {
			confirmation.primaryButton = nls.localize({ key: 'yesButton', comment: ['&& denotes a mnemonic'] }, "&&Yes");
		}

		if (!confirmation.secondaryButton) {
			confirmation.secondaryButton = nls.localize('cancelButton', "Cancel");
		}

		let opts: Electron.Dialog.ShowMessageBoxOptions = {
			title: confirmation.title || this.contextService.getConfiguration().env.appName,
			message: confirmation.message,
			buttons: [
				this.mnemonicLabel(confirmation.primaryButton),
				this.mnemonicLabel(confirmation.secondaryButton)
			],
			noLink: true,
			cancelId: 1
		};

		if (confirmation.detail) {
			opts.detail = confirmation.detail;
		}

		let result = this.windowService.getWindow().showMessageBox(opts);

		return result === 0 ? true : false;
	}
开发者ID:578723746,项目名称:vscode,代码行数:28,代码来源:messageService.ts


示例10: confirm

	public confirm(confirmation: IConfirmation): boolean {
		if (!confirmation.primaryButton) {
			confirmation.primaryButton = nls.localize('yesButton', "Yes");
		}

		if (!confirmation.secondaryButton) {
			confirmation.secondaryButton = nls.localize('cancelButton', "Cancel");
		}

		let opts: remote.IMessageBoxOptions = {
			title: confirmation.title || this.contextService.getConfiguration().env.appName,
			message: confirmation.message,
			buttons: [
				confirmation.primaryButton,
				confirmation.secondaryButton
			],
			noLink: true,
			cancelId: 1
		};

		if (confirmation.detail) {
			opts.detail = confirmation.detail;
		}

		let result = this.windowService.getWindow().showMessageBox(opts);

		return result === 0 ? true : false;
	}
开发者ID:gaoxiaojun,项目名称:vscode,代码行数:28,代码来源:messageService.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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