workspace.ts 3.4 KB
Newer Older
E
Erich Gamma 已提交
1 2 3 4 5 6 7
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
'use strict';

import URI from 'vs/base/common/uri';
8
import {createDecorator} from 'vs/platform/instantiation/common/instantiation';
E
Erich Gamma 已提交
9

B
Benjamin Pasero 已提交
10
export const IWorkspaceContextService = createDecorator<IWorkspaceContextService>('contextService');
E
Erich Gamma 已提交
11 12

export interface IWorkspaceContextService {
13
	_serviceBrand: any;
E
Erich Gamma 已提交
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92

	/**
	 * Provides access to the workspace object the platform is running with. This may be null if the workbench was opened
	 * without workspace (empty);
	 */
	getWorkspace(): IWorkspace;

	/**
	 * Provides access to the configuration object the platform is running with.
	 */
	getConfiguration(): IConfiguration;

	/**
	 * Provides access to the options object the platform is running with.
	 */
	getOptions(): any;

	/**
	 * Returns iff the provided resource is inside the workspace or not.
	 */
	isInsideWorkspace(resource: URI): boolean;

	/**
	 * Given a resource inside the workspace, returns its relative path from the workspace root
	 * without leading or trailing slashes. Returns null if the file is not inside an opened
	 * workspace.
	 */
	toWorkspaceRelativePath: (resource: URI) => string;

	/**
	 * Given a workspace relative path, returns the resource with the absolute path.
	 */
	toResource: (workspaceRelativePath: string) => URI;
}

export interface IWorkspace {

	/**
	 * the full uri of the workspace. this is a file:// URL to the location
	 * of the workspace on disk.
	 */
	resource: URI;

	/**
	 * the identifier that uniquely identifies this workspace among others.
	 */
	id: string;

	/**
	 * the name of the workspace
	 */
	name: string;

	/**
	 * the last modified date of the workspace if known
	 */
	mtime?: number;

	/**
	 * the unique identifier of the workspace. if the workspace is deleted and recreated
	 * the identifier also changes. this makes the uid more unique compared to the id which
	 * is just derived from the workspace name.
	 */
	uid?: number;
}

export interface IConfiguration {
	/**
	 * Some environmental flags
	 */
	env?: IEnvironment;
}

export interface IEnvironment {
	appName: string;
	appRoot: string;
	isBuilt: boolean;
	execPath: string;

J
Joao Moreno 已提交
93 94 95
	applicationName: string;
	darwinBundleIdentifier: string;

E
Erich Gamma 已提交
96 97 98 99 100 101 102 103 104 105 106
	version: string;
	commitHash: string;

	updateFeedUrl: string;
	updateChannel: string;

	extensionsGallery: {
		serviceUrl: string;
		itemUrl: string;
	};

107 108
	extensionTips: { [id: string]: string; };

E
Erich Gamma 已提交
109
	releaseNotesUrl: string;
110
	licenseUrl: string;
E
Erich Gamma 已提交
111 112 113 114 115 116 117 118 119 120
	productDownloadUrl: string;

	welcomePage: string;

	crashReporter: any;

	appSettingsHome: string;
	appSettingsPath: string;
	appKeybindingsPath: string;

121 122
	debugExtensionHostPort: number;
	debugBrkExtensionHost: boolean;
A
Alex Dima 已提交
123
	disableExtensions: boolean;
E
Erich Gamma 已提交
124

125
	logExtensionHostCommunication: boolean;
126
	debugBrkFileWatcherPort: number;
E
Erich Gamma 已提交
127 128 129
	verboseLogging: boolean;
	enablePerformance: boolean;

A
Alex Dima 已提交
130
	userExtensionsHome: string;
E
Erich Gamma 已提交
131
	sharedIPCHandle: string;
A
Alex Dima 已提交
132 133
	extensionDevelopmentPath: string;
	extensionTestsPath: string;
E
Erich Gamma 已提交
134

135 136
	recentFiles: string[];
	recentFolders: string[];
E
Erich Gamma 已提交
137 138 139 140 141 142

	enableTelemetry: boolean;

	aiConfig: {
		key: string;
		asimovKey: string;
B
Benjamin Pasero 已提交
143
	};
S
Sofian Hnaide 已提交
144 145 146 147

	sendASmile: {
		reportIssueUrl: string,
		requestFeatureUrl: string
B
Benjamin Pasero 已提交
148
	};
E
Erich Gamma 已提交
149
}