mirror of
https://github.com/coder/code-server.git
synced 2026-06-25 03:17:11 +02:00
chore(vscode): update to 1.54.2
This commit is contained in:
@@ -9,34 +9,41 @@ import { Workbench } from 'vs/workbench/browser/workbench';
|
||||
import { NativeWindow } from 'vs/workbench/electron-sandbox/window';
|
||||
import { setZoomLevel, setZoomFactor, setFullscreen } from 'vs/base/browser/browser';
|
||||
import { domContentLoaded } from 'vs/base/browser/dom';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { INativeWorkbenchConfiguration, INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { reviveIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier, IWorkspaceInitializationPayload, reviveIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { ILoggerService, ILogService } from 'vs/platform/log/common/log';
|
||||
import { NativeStorageService2 } from 'vs/platform/storage/electron-sandbox/storageService2';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IWorkbenchConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IMainProcessService, ElectronIPCMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService';
|
||||
import { IMainProcessService } from 'vs/platform/ipc/electron-sandbox/services';
|
||||
import { RemoteAuthorityResolverService } from 'vs/platform/remote/electron-sandbox/remoteAuthorityResolverService';
|
||||
import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver';
|
||||
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
|
||||
import { RemoteAgentService } from 'vs/workbench/services/remote/electron-sandbox/remoteAgentServiceImpl';
|
||||
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
|
||||
import { FileService } from 'vs/platform/files/common/fileService';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { RemoteFileSystemProvider } from 'vs/workbench/services/remote/common/remoteAgentFileSystemChannel';
|
||||
import { ISignService } from 'vs/platform/sign/common/sign';
|
||||
import { FileUserDataProvider } from 'vs/workbench/services/userData/common/fileUserDataProvider';
|
||||
import { basename } from 'vs/base/common/path';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
|
||||
import { NativeHostService } from 'vs/platform/native/electron-sandbox/nativeHostService';
|
||||
import { SimpleConfigurationService, simpleFileSystemProvider, SimpleLogService, SimpleSignService, SimpleStorageService, SimpleNativeWorkbenchEnvironmentService, SimpleWorkspaceService } from 'vs/workbench/electron-sandbox/sandbox.simpleservices';
|
||||
import { INativeWorkbenchConfiguration, INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService';
|
||||
import { RemoteAuthorityResolverService } from 'vs/platform/remote/electron-sandbox/remoteAuthorityResolverService';
|
||||
import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity';
|
||||
import { UriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentityService';
|
||||
import { KeyboardLayoutService } from 'vs/workbench/services/keybinding/electron-sandbox/nativeKeyboardLayout';
|
||||
import { IKeyboardLayoutService } from 'vs/platform/keyboardLayout/common/keyboardLayout';
|
||||
import { ElectronIPCMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService';
|
||||
import { SimpleConfigurationService, simpleFileSystemProvider, SimpleSignService, SimpleNativeWorkbenchEnvironmentService, SimpleWorkspaceService, SimpleLogService } from 'vs/workbench/electron-sandbox/sandbox.simpleservices';
|
||||
import { LoggerChannelClient } from 'vs/platform/log/common/logIpc';
|
||||
|
||||
class DesktopMain extends Disposable {
|
||||
|
||||
@@ -64,7 +71,10 @@ class DesktopMain extends Disposable {
|
||||
private reviveUris() {
|
||||
|
||||
// Workspace
|
||||
this.configuration.workspace = reviveIdentifier(this.configuration.workspace);
|
||||
const workspace = reviveIdentifier(this.configuration.workspace);
|
||||
if (isWorkspaceIdentifier(workspace) || isSingleFolderWorkspaceIdentifier(workspace)) {
|
||||
this.configuration.workspace = workspace;
|
||||
}
|
||||
|
||||
// Files
|
||||
const filesToWait = this.configuration.filesToWait;
|
||||
@@ -106,14 +116,14 @@ class DesktopMain extends Disposable {
|
||||
services.logService.trace('workbench configuration', JSON.stringify(this.configuration));
|
||||
}
|
||||
|
||||
private registerListeners(workbench: Workbench, storageService: SimpleStorageService): void {
|
||||
private registerListeners(workbench: Workbench, storageService: NativeStorageService2): void {
|
||||
|
||||
// Workbench Lifecycle
|
||||
this._register(workbench.onShutdown(() => this.dispose()));
|
||||
this._register(workbench.onWillShutdown(event => event.join(storageService.close(), 'join.closeStorage')));
|
||||
this._register(workbench.onShutdown(() => this.dispose()));
|
||||
}
|
||||
|
||||
private async initServices(): Promise<{ serviceCollection: ServiceCollection, logService: ILogService, storageService: SimpleStorageService }> {
|
||||
private async initServices(): Promise<{ serviceCollection: ServiceCollection, logService: ILogService, storageService: NativeStorageService2 }> {
|
||||
const serviceCollection = new ServiceCollection();
|
||||
|
||||
|
||||
@@ -141,7 +151,11 @@ class DesktopMain extends Disposable {
|
||||
// Product
|
||||
serviceCollection.set(IProductService, this.productService);
|
||||
|
||||
// Log
|
||||
// Logger
|
||||
const loggerService = new LoggerChannelClient(mainProcessService.getChannel('logger'));
|
||||
serviceCollection.set(ILoggerService, loggerService);
|
||||
|
||||
// Log (we can only use the real logger, once `IEnvironmentService#logFile` has a proper file:// based value (https://github.com/microsoft/vscode/issues/116829))
|
||||
const logService = new SimpleLogService();
|
||||
serviceCollection.set(ILogService, logService);
|
||||
|
||||
@@ -208,6 +222,8 @@ class DesktopMain extends Disposable {
|
||||
fileService.registerProvider(Schemas.vscodeRemote, remoteFileSystemProvider);
|
||||
}
|
||||
|
||||
const payload = this.resolveWorkspaceInitializationPayload();
|
||||
|
||||
const services = await Promise.all([
|
||||
this.createWorkspaceService().then(service => {
|
||||
|
||||
@@ -220,11 +236,19 @@ class DesktopMain extends Disposable {
|
||||
return service;
|
||||
}),
|
||||
|
||||
this.createStorageService().then(service => {
|
||||
this.createStorageService(payload, mainProcessService).then(service => {
|
||||
|
||||
// Storage
|
||||
serviceCollection.set(IStorageService, service);
|
||||
|
||||
return service;
|
||||
}),
|
||||
|
||||
this.createKeyboardLayoutService(mainProcessService).then(service => {
|
||||
|
||||
// KeyboardLayout
|
||||
serviceCollection.set(IKeyboardLayoutService, service);
|
||||
|
||||
return service;
|
||||
})
|
||||
]);
|
||||
@@ -246,12 +270,56 @@ class DesktopMain extends Disposable {
|
||||
return { serviceCollection, logService, storageService: services[1] };
|
||||
}
|
||||
|
||||
private resolveWorkspaceInitializationPayload(): IWorkspaceInitializationPayload {
|
||||
let workspaceInitializationPayload: IWorkspaceInitializationPayload | undefined = this.configuration.workspace;
|
||||
|
||||
// Fallback to empty workspace if we have no payload yet.
|
||||
if (!workspaceInitializationPayload) {
|
||||
let id: string;
|
||||
if (this.configuration.backupPath) {
|
||||
id = basename(this.configuration.backupPath); // we know the backupPath must be a unique path so we leverage its name as workspace ID
|
||||
} else if (this.environmentService.isExtensionDevelopment) {
|
||||
id = 'ext-dev'; // extension development window never stores backups and is a singleton
|
||||
} else {
|
||||
throw new Error('Unexpected window configuration without backupPath');
|
||||
}
|
||||
|
||||
workspaceInitializationPayload = { id };
|
||||
}
|
||||
|
||||
return workspaceInitializationPayload;
|
||||
}
|
||||
|
||||
private async createWorkspaceService(): Promise<IWorkspaceContextService> {
|
||||
return new SimpleWorkspaceService();
|
||||
}
|
||||
|
||||
private async createStorageService(): Promise<SimpleStorageService> {
|
||||
return new SimpleStorageService();
|
||||
private async createStorageService(payload: IWorkspaceInitializationPayload, mainProcessService: IMainProcessService): Promise<NativeStorageService2> {
|
||||
const storageService = new NativeStorageService2(payload, mainProcessService, this.environmentService);
|
||||
|
||||
try {
|
||||
await storageService.initialize();
|
||||
|
||||
return storageService;
|
||||
} catch (error) {
|
||||
onUnexpectedError(error);
|
||||
|
||||
return storageService;
|
||||
}
|
||||
}
|
||||
|
||||
private async createKeyboardLayoutService(mainProcessService: IMainProcessService): Promise<KeyboardLayoutService> {
|
||||
const keyboardLayoutService = new KeyboardLayoutService(mainProcessService);
|
||||
|
||||
try {
|
||||
await keyboardLayoutService.initialize();
|
||||
|
||||
return keyboardLayoutService;
|
||||
} catch (error) {
|
||||
onUnexpectedError(error);
|
||||
|
||||
return keyboardLayoutService;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user