api - introduce env.uiKind (web, desktop)
This commit is contained in:
parent
3fd9684eb5
commit
f8effd5fad
7 changed files with 55 additions and 6 deletions
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { env, extensions, ExtensionKind } from 'vscode';
|
||||
import { env, extensions, ExtensionKind, UIKind } from 'vscode';
|
||||
|
||||
suite('env-namespace', () => {
|
||||
|
||||
|
@ -44,4 +44,9 @@ suite('env-namespace', () => {
|
|||
assert.fail();
|
||||
}
|
||||
});
|
||||
|
||||
test('env.uiKind', function () {
|
||||
const kind = env.uiKind;
|
||||
assert.equal(kind, UIKind.Desktop);
|
||||
});
|
||||
});
|
||||
|
|
30
src/vs/vscode.proposed.d.ts
vendored
30
src/vs/vscode.proposed.d.ts
vendored
|
@ -1011,6 +1011,36 @@ declare module 'vscode' {
|
|||
|
||||
//#endregion
|
||||
|
||||
// #region Ben - UIKind
|
||||
|
||||
/**
|
||||
* Possible kinds of UI that can use extensions.
|
||||
*/
|
||||
export enum UIKind {
|
||||
|
||||
/**
|
||||
* Extensions are accessed from a desktop application.
|
||||
*/
|
||||
Desktop = 1,
|
||||
|
||||
/**
|
||||
* Extensions are accessed from a web browser.
|
||||
*/
|
||||
Web = 2
|
||||
}
|
||||
|
||||
export namespace env {
|
||||
|
||||
/**
|
||||
* The UI kind property indicates from which UI extensions
|
||||
* are accessed from. For example, extensions could be accessed
|
||||
* from a desktop application or a web browser.
|
||||
*/
|
||||
export const uiKind: UIKind;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Custom editors, mjbvz
|
||||
|
||||
export enum WebviewEditorState {
|
||||
|
|
|
@ -15,7 +15,7 @@ import { OverviewRulerLane } from 'vs/editor/common/model';
|
|||
import * as languageConfiguration from 'vs/editor/common/modes/languageConfiguration';
|
||||
import { score } from 'vs/editor/common/modes/languageSelector';
|
||||
import * as files from 'vs/platform/files/common/files';
|
||||
import { ExtHostContext, MainContext, ExtHostLogServiceShape } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { ExtHostContext, MainContext, ExtHostLogServiceShape, UIKind } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { ExtHostApiCommands } from 'vs/workbench/api/common/extHostApiCommands';
|
||||
import { ExtHostClipboard } from 'vs/workbench/api/common/extHostClipboard';
|
||||
import { IExtHostCommands } from 'vs/workbench/api/common/extHostCommands';
|
||||
|
@ -250,6 +250,10 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
|||
},
|
||||
get remoteName() {
|
||||
return getRemoteName(initData.remote.authority);
|
||||
},
|
||||
get uiKind() {
|
||||
checkProposedApiEnabled(extension);
|
||||
return initData.uiKind;
|
||||
}
|
||||
};
|
||||
if (!initData.environment.extensionTestsLocationURI) {
|
||||
|
@ -898,6 +902,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
|||
CallHierarchyItem: extHostTypes.CallHierarchyItem,
|
||||
Decoration: extHostTypes.Decoration,
|
||||
WebviewEditorState: extHostTypes.WebviewEditorState,
|
||||
UIKind: UIKind
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -87,6 +87,7 @@ export interface IInitData {
|
|||
logsLocation: URI;
|
||||
autoStart: boolean;
|
||||
remote: { isRemote: boolean; authority: string | undefined; };
|
||||
uiKind: UIKind;
|
||||
}
|
||||
|
||||
export interface IConfigurationInitData extends IConfigurationData {
|
||||
|
@ -105,6 +106,11 @@ export interface IExtHostContext extends IRPCProtocol {
|
|||
export interface IMainContext extends IRPCProtocol {
|
||||
}
|
||||
|
||||
export enum UIKind {
|
||||
Desktop = 1,
|
||||
Web = 2
|
||||
}
|
||||
|
||||
// --- main thread
|
||||
|
||||
export interface MainThreadClipboardShape extends IDisposable {
|
||||
|
|
|
@ -9,7 +9,7 @@ import { DisposableStore, toDisposable } from 'vs/base/common/lifecycle';
|
|||
import { IMessagePassingProtocol } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { VSBuffer } from 'vs/base/common/buffer';
|
||||
import { createMessageOfType, MessageType, isMessageOfType } from 'vs/workbench/services/extensions/common/extensionHostProtocol';
|
||||
import { IInitData } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { IInitData, UIKind } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
|
@ -150,6 +150,7 @@ export class WebWorkerExtensionHostStarter implements IExtensionHostStarter {
|
|||
authority: this._environmentService.configuration.remoteAuthority,
|
||||
isRemote: false
|
||||
},
|
||||
uiKind: platform.isWeb ? UIKind.Web : UIKind.Desktop
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
|||
import { connectRemoteAgentExtensionHost, IRemoteExtensionHostStartParams, IConnectionOptions, ISocketFactory } from 'vs/platform/remote/common/remoteAgentConnection';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
|
||||
import { IInitData } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { IInitData, UIKind } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { MessageType, createMessageOfType, isMessageOfType } from 'vs/workbench/services/extensions/common/extensionHostProtocol';
|
||||
import { IExtensionHostStarter } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { parseExtensionDevOptions } from 'vs/workbench/services/extensions/common/extensionDevOptions';
|
||||
|
@ -215,6 +215,7 @@ export class RemoteExtensionHostClient extends Disposable implements IExtensionH
|
|||
logLevel: this._logService.getLevel(),
|
||||
logsLocation: remoteExtensionHostData.extensionHostLogsPath,
|
||||
autoStart: true,
|
||||
uiKind: platform.isWeb ? UIKind.Web : UIKind.Desktop
|
||||
};
|
||||
return r;
|
||||
});
|
||||
|
|
|
@ -29,7 +29,7 @@ import { INotificationService, Severity } from 'vs/platform/notification/common/
|
|||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IWindowService, IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
|
||||
import { IInitData } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { IInitData, UIKind } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { MessageType, createMessageOfType, isMessageOfType } from 'vs/workbench/services/extensions/common/extensionHostProtocol';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
|
@ -420,7 +420,8 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter {
|
|||
telemetryInfo,
|
||||
logLevel: this._logService.getLevel(),
|
||||
logsLocation: this._extensionHostLogsLocation,
|
||||
autoStart: this._autoStart
|
||||
autoStart: this._autoStart,
|
||||
uiKind: UIKind.Desktop
|
||||
};
|
||||
return r;
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue