Implement a `handle` property that is a string (#233267)
* Implement a `handle` property that is a string For Microsoft auth * fix integration tests
This commit is contained in:
Родитель
8abfad3e3e
Коммит
15333a70d8
|
@ -30,6 +30,7 @@
|
|||
"interactive",
|
||||
"languageStatusText",
|
||||
"mappedEditsProvider",
|
||||
"nativeWindowHandle",
|
||||
"notebookCellExecutionState",
|
||||
"notebookDeprecated",
|
||||
"notebookLiveShare",
|
||||
|
|
|
@ -245,6 +245,9 @@ const _allApiProposals = {
|
|||
multiDocumentHighlightProvider: {
|
||||
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.multiDocumentHighlightProvider.d.ts',
|
||||
},
|
||||
nativeWindowHandle: {
|
||||
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.nativeWindowHandle.d.ts',
|
||||
},
|
||||
newSymbolNamesProvider: {
|
||||
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.newSymbolNamesProvider.d.ts',
|
||||
},
|
||||
|
|
|
@ -354,6 +354,7 @@ export interface IOSConfiguration {
|
|||
|
||||
export interface INativeWindowConfiguration extends IWindowConfiguration, NativeParsedArgs, ISandboxConfiguration {
|
||||
mainPid: number;
|
||||
handle?: string;
|
||||
|
||||
machineId: string;
|
||||
sqmId: string;
|
||||
|
|
|
@ -1092,6 +1092,11 @@ export class CodeWindow extends BaseWindow implements ICodeWindow {
|
|||
}
|
||||
|
||||
// Update window related properties
|
||||
try {
|
||||
configuration.handle = this._win.getNativeWindowHandle().toString('base64');
|
||||
} catch (error) {
|
||||
this.logService.error(`Error getting native window handle: ${error}`);
|
||||
}
|
||||
configuration.fullscreen = this.isFullScreen;
|
||||
configuration.maximized = this._win.isMaximized();
|
||||
configuration.partsSplash = this.themeMainService.getWindowSplash();
|
||||
|
|
|
@ -437,6 +437,10 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
|||
checkProposedApiEnabled(extension, 'resolvers');
|
||||
return initData.commit;
|
||||
},
|
||||
get handle(): string | undefined {
|
||||
checkProposedApiEnabled(extension, 'nativeWindowHandle');
|
||||
return initData.handle;
|
||||
}
|
||||
};
|
||||
if (!initData.environment.extensionTestsLocationURI) {
|
||||
// allow to patch env-function when running tests
|
||||
|
|
|
@ -26,6 +26,7 @@ export interface INativeWorkbenchEnvironmentService extends IBrowserWorkbenchEnv
|
|||
// --- Window
|
||||
readonly window: {
|
||||
id: number;
|
||||
handle?: string;
|
||||
colorScheme: IColorScheme;
|
||||
maximized?: boolean;
|
||||
accessibilitySupport?: boolean;
|
||||
|
@ -83,6 +84,7 @@ export class NativeWorkbenchEnvironmentService extends AbstractNativeEnvironment
|
|||
get window() {
|
||||
return {
|
||||
id: this.configuration.windowId,
|
||||
handle: this.configuration.handle,
|
||||
colorScheme: this.configuration.colorScheme,
|
||||
maximized: this.configuration.maximized,
|
||||
accessibilitySupport: this.configuration.accessibilitySupport,
|
||||
|
|
|
@ -53,6 +53,7 @@ export interface IExtensionHostInitData {
|
|||
consoleForward: { includeStack: boolean; logNative: boolean };
|
||||
uiKind: UIKind;
|
||||
messagePorts?: ReadonlyMap<string, MessagePortLike>;
|
||||
handle?: string;
|
||||
}
|
||||
|
||||
export interface IEnvironment {
|
||||
|
|
|
@ -511,7 +511,8 @@ export class NativeLocalProcessExtensionHost implements IExtensionHost {
|
|||
loggers: [...this._loggerService.getRegisteredLoggers()],
|
||||
logsLocation: this._environmentService.extHostLogsPath,
|
||||
autoStart: (this.startup === ExtensionHostStartup.EagerAutoStart),
|
||||
uiKind: UIKind.Desktop
|
||||
uiKind: UIKind.Desktop,
|
||||
handle: this._environmentService.window.handle
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
// https://github.com/microsoft/vscode/issues/229431
|
||||
|
||||
declare module 'vscode' {
|
||||
|
||||
export namespace env {
|
||||
/**
|
||||
* Retrieves a base64 representation of a native window
|
||||
* handle of the current window.
|
||||
*/
|
||||
export const handle: string | undefined;
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче