Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/platform/environment/common/environment.ts
5240 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { URI } from '../../../base/common/uri.js';
7
import { NativeParsedArgs } from './argv.js';
8
import { createDecorator, refineServiceDecorator } from '../../instantiation/common/instantiation.js';
9
10
export const IEnvironmentService = createDecorator<IEnvironmentService>('environmentService');
11
export const INativeEnvironmentService = refineServiceDecorator<IEnvironmentService, INativeEnvironmentService>(IEnvironmentService);
12
13
export interface IDebugParams {
14
port: number | null;
15
break: boolean;
16
}
17
18
export interface IExtensionHostDebugParams extends IDebugParams {
19
debugId?: string;
20
env?: Record<string, string>;
21
}
22
23
/**
24
* Type of extension.
25
*
26
* **NOTE**: This is defined in `platform/environment` because it can appear as a CLI argument.
27
*/
28
export type ExtensionKind = 'ui' | 'workspace' | 'web';
29
30
/**
31
* A basic environment service that can be used in various processes,
32
* such as main, renderer and shared process. Use subclasses of this
33
* service for specific environment.
34
*/
35
export interface IEnvironmentService {
36
37
readonly _serviceBrand: undefined;
38
39
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
40
//
41
// NOTE: KEEP THIS INTERFACE AS SMALL AS POSSIBLE.
42
//
43
// AS SUCH:
44
// - PUT NON-WEB PROPERTIES INTO NATIVE ENVIRONMENT SERVICE
45
// - PUT WORKBENCH ONLY PROPERTIES INTO WORKBENCH ENVIRONMENT SERVICE
46
// - PUT ELECTRON-MAIN ONLY PROPERTIES INTO MAIN ENVIRONMENT SERVICE
47
//
48
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
49
50
// --- user roaming data
51
stateResource: URI;
52
userRoamingDataHome: URI;
53
keyboardLayoutResource: URI;
54
argvResource: URI;
55
56
// --- data paths
57
untitledWorkspacesHome: URI;
58
workspaceStorageHome: URI;
59
localHistoryHome: URI;
60
cacheHome: URI;
61
builtinWorkbenchModesHome: URI;
62
63
// --- settings sync
64
userDataSyncHome: URI;
65
sync: 'on' | 'off' | undefined;
66
67
// --- continue edit session
68
continueOn?: string;
69
editSessionId?: string;
70
71
// --- extension development
72
debugExtensionHost: IExtensionHostDebugParams;
73
isExtensionDevelopment: boolean;
74
disableExtensions: boolean | string[];
75
enableExtensions?: readonly string[];
76
extensionDevelopmentLocationURI?: URI[];
77
extensionDevelopmentKind?: ExtensionKind[];
78
extensionTestsLocationURI?: URI;
79
80
// --- logging
81
logsHome: URI;
82
logLevel?: string;
83
extensionLogLevel?: [string, string][];
84
verbose: boolean;
85
isBuilt: boolean;
86
87
// --- telemetry/exp
88
disableTelemetry: boolean;
89
disableExperiments: boolean;
90
serviceMachineIdResource: URI;
91
92
// --- agent sessions workspace
93
agentSessionsWorkspace?: URI;
94
95
// --- Policy
96
policyFile?: URI;
97
98
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
99
//
100
// NOTE: KEEP THIS INTERFACE AS SMALL AS POSSIBLE.
101
//
102
// AS SUCH:
103
// - PUT NON-WEB PROPERTIES INTO NATIVE ENVIRONMENT SERVICE
104
// - PUT WORKBENCH ONLY PROPERTIES INTO WORKBENCH ENVIRONMENT SERVICE
105
// - PUT ELECTRON-MAIN ONLY PROPERTIES INTO MAIN ENVIRONMENT SERVICE
106
//
107
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
108
}
109
110
/**
111
* A subclass of the `IEnvironmentService` to be used only in native
112
* environments (Windows, Linux, macOS) but not e.g. web.
113
*/
114
export interface INativeEnvironmentService extends IEnvironmentService {
115
116
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
117
//
118
// NOTE: KEEP THIS INTERFACE AS SMALL AS POSSIBLE.
119
//
120
// AS SUCH:
121
// - PUT WORKBENCH ONLY PROPERTIES INTO WORKBENCH ENVIRONMENT SERVICE
122
// - PUT ELECTRON-MAIN ONLY PROPERTIES INTO MAIN ENVIRONMENT SERVICE
123
//
124
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
125
126
// --- CLI Arguments
127
args: NativeParsedArgs;
128
129
// --- data paths
130
/**
131
* Root path of the JavaScript sources.
132
*
133
* Note: This is NOT the installation root
134
* directory itself but contained in it at
135
* a level that is platform dependent.
136
*/
137
appRoot: string;
138
userHome: URI;
139
appSettingsHome: URI;
140
tmpDir: URI;
141
userDataPath: string;
142
143
// --- extensions
144
extensionsPath: string;
145
extensionsDownloadLocation: URI;
146
builtinExtensionsPath: string;
147
148
// --- use in-memory Secret Storage
149
useInMemorySecretStorage?: boolean;
150
151
crossOriginIsolated?: boolean;
152
exportPolicyData?: string;
153
154
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
155
//
156
// NOTE: KEEP THIS INTERFACE AS SMALL AS POSSIBLE.
157
//
158
// AS SUCH:
159
// - PUT NON-WEB PROPERTIES INTO NATIVE ENVIRONMENT SERVICE
160
// - PUT WORKBENCH ONLY PROPERTIES INTO WORKBENCH ENVIRONMENT SERVICE
161
// - PUT ELECTRON-MAIN ONLY PROPERTIES INTO MAIN ENVIRONMENT SERVICE
162
//
163
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
164
}
165
166