提交 95d150db 编写于 作者: J Johannes Rieken

add `vscode.env.appRoot`

上级 455cddfc
......@@ -12,6 +12,7 @@ suite('env-namespace', () => {
test('env is set', function () {
assert.equal(typeof env.language, 'string');
assert.equal(typeof env.appRoot, 'string');
assert.equal(typeof env.appName, 'string');
assert.equal(typeof env.machineId, 'string');
assert.equal(typeof env.sessionId, 'string');
......@@ -19,9 +20,10 @@ suite('env-namespace', () => {
test('env is readonly', function () {
assert.throws(() => env.language = '234');
assert.throws(() => env.appRoot = '234');
assert.throws(() => env.appName = '234');
assert.throws(() => env.machineId = '234');
assert.throws(() => env.sessionId = '234');
});
});
\ No newline at end of file
});
......@@ -3970,6 +3970,13 @@ declare module 'vscode' {
*/
export let appName: string;
/**
* The application root folder from which the editor is running.
*
* @readonly
*/
export let appRoot: string;
/**
* Represents the preferred user-language, like `de-CH`, `fr`, or `en-US`.
*
......
......@@ -201,7 +201,8 @@ export function createApiFactory(
get machineId() { return initData.telemetryInfo.machineId; },
get sessionId() { return initData.telemetryInfo.sessionId; },
get language() { return Platform.language; },
get appName() { return product.nameLong; }
get appName() { return product.nameLong; },
get appRoot() { return initData.environment.appRoot; },
});
// namespace: extensions
......
......@@ -53,6 +53,7 @@ export interface IEnvironment {
isExtensionDevelopmentDebug: boolean;
enableProposedApiForAll: boolean;
enableProposedApiFor: string | string[];
appRoot: string;
appSettingsHome: string;
disableExtensions: boolean;
userExtensionsHome: string;
......
......@@ -341,6 +341,7 @@ export class ExtensionHostProcessWorker {
parentPid: process.pid,
environment: {
isExtensionDevelopmentDebug: this._isExtensionDevDebug,
appRoot: this._environmentService.appRoot,
appSettingsHome: this._environmentService.appSettingsHome,
disableExtensions: this._environmentService.disableExtensions,
userExtensionsHome: this._environmentService.extensionsPath,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册