Archived
1
0

Client partially loaded

Need to resolve the remaining modules and then check and apply any
necessary patches.
This commit is contained in:
Asher
2019-01-14 18:31:52 -06:00
committed by Kyle Carberry
parent 24a86b81ba
commit 2ff34bc5e2
5 changed files with 180 additions and 453 deletions

View File

@ -20,10 +20,6 @@ const load = (): Promise<void> => {
],
});
client.mkDirs.then(() => {
resolve();
});
const importTime = time(1500);
import(/* webpackPrefetch: true */ "./workbench").then((module) => {
logger.info("Loaded workbench bundle", field("duration", importTime));

View File

@ -1,11 +1,11 @@
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IStorageService, StorageScope } from "vs/platform/storage/common/storage";
export class StorageService implements IStorageService {
public _serviceBrand: any;
private _globalObject: object;
private _workspaceObject: object;
private _globalObject: { [key: string]: any };
private _workspaceObject: { [ key: string]: any };
public constructor(globalState: object, workspaceState: object) {
this._globalObject = globalState;
@ -39,12 +39,13 @@ export class StorageService implements IStorageService {
public getBoolean(key: string, scope?: StorageScope, defaultValue?: boolean): boolean {
const v = this.get(key, scope);
if (typeof v !== "undefined") {
return v === 'true';
return v === "true";
}
return defaultValue;
}
private getObject(scope = StorageScope.GLOBAL): object {
private getObject(scope = StorageScope.GLOBAL): { [key: string]: any } {
switch (scope) {
case StorageScope.GLOBAL:
return this._globalObject;
@ -55,4 +56,4 @@ export class StorageService implements IStorageService {
}
}
}
}

View File

@ -1,40 +1,19 @@
import * as fs from "fs";
import {
Client, Emitter, getFactory, IPosition, IFileConflict, ConflictResolution,
Event,
IDisposable,
IDocumentContentChangedEvent, IURI, IRange, escapePath,
IOrphanedChangedEvent,
} from 'coder/common';
import { Protocol } from 'vs/base/parts/ipc/node/ipc.net';
import { IModelService } from 'vs/editor/common/services/modelService';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { ShutdownReason } from 'vs/platform/lifecycle/common/lifecycle';
import { TPromise } from 'vs/base/common/winjs.base';
import { ITextModel, TrackedRangeStickiness, IModelDeltaDecoration } from 'vs/editor/common/model';
import { Position } from 'vs/editor/common/core/position';
import { Selection } from 'vs/editor/common/core/selection';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { registerContextMenuListener } from 'vs/base/parts/contextmenu/electron-main/contextmenu';
import { Workbench } from 'vs/workbench/electron-browser/workbench';
import { StorageService } from 'coder/storageService';
import { IContentData, IFileService, FileOperationError, FileOperationResult, FileSystemProviderCapabilities, IStat, FileType } from 'vs/platform/files/common/files';
import { onInstantiation as onFileServiceInstantiation } from 'vs/workbench/services/files/electron-browser/fileService';
import { URI } from 'vs/base/common/uri';
import { EventEmitter } from 'events';
import { Range } from 'vs/editor/common/core/range';
import product from 'vs/platform/node/product';
import { CONFLICT_RESOLUTION_SCHEME } from 'vs/workbench/parts/files/electron-browser/saveErrorHandler';
import { ITextFileService, ModelState } from 'vs/workbench/services/textfile/common/textfiles';
import { field, logger } from 'coder/logger';
import { events } from 'coder/analytics';
import { IDecorationsService } from 'vs/workbench/services/decorations/browser/decorations';
import { registerCollaboratorDecorations } from 'coder/collaborators';
import { IInitData as ISharedProcessInitData } from 'vs/code/electron-browser/sharedProcess/sharedProcessClient';
import { LogLevel } from 'vs/platform/log/common/log';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { toLocalISOString } from 'vs/base/common/date';
import { RawContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { Client } from "@coder/ide";
import { Emitter } from "@coder/events";
import { logger } from "@coder/logger";
import { Protocol } from "vs/base/parts/ipc/node/ipc.net";
import { IModelService } from "vs/editor/common/services/modelService";
import { ICodeEditorService } from "vs/editor/browser/services/codeEditorService";
import { registerContextMenuListener } from "vs/base/parts/contextmenu/electron-main/contextmenu";
import { Workbench } from "vs/workbench/electron-browser/workbench";
import { IDecorationsService } from "vs/workbench/services/decorations/browser/decorations";
import { LogLevel } from "vs/platform/log/common/log";
import { INotificationService, Severity } from "vs/platform/notification/common/notification";
import { toLocalISOString } from "vs/base/common/date";
import { RawContextKey, IContextKeyService } from "vs/platform/contextkey/common/contextkey";
import { StorageService } from "./storageService";
let protoResolve: (protocol: Protocol) => void;
export const protocolPromise = new Promise<Protocol>((res) => {
@ -79,14 +58,6 @@ function getCodeEditorService(): ICodeEditorService {
return workbench.workbenchParams.serviceCollection.get(ICodeEditorService) as ICodeEditorService;
}
function getFileService(): IFileService {
return workbench.workbenchParams.serviceCollection.get(IFileService) as IFileService;
}
function getTextFileService(): ITextFileService {
return workbench.workbenchParams.serviceCollection.get(ITextFileService) as ITextFileService;
}
function getNotificationService(): INotificationService {
return workbench.workbenchParams.serviceCollection.get(INotificationService) as INotificationService;
}
@ -96,6 +67,7 @@ export const initialize = async (client: Client): Promise<void> {
event.preventDefault();
});
// TODO: Fetch configuration.
const storageServicePromise = client.wrapTask("Set configurations", 5, async (state) => {
const storageService = new StorageService(state.global, state.workspace);
storageResolve(storageService);
@ -239,7 +211,14 @@ export const initialize = async (client: Client): Promise<void> {
await registerCollaboratorDecorations(client, decorations);
return workbenchShell;
}, client.workspace.then((w) => w.connect()), mountPromise, client.mkDirs);
}, client.mkDirs);
client.wrapTask("Set up saving state", 5, async () => {
if (!navigator.sendBeacon) {
throw new Error("cannot save state");
}
// TODO: save storageSevice.globalObject and storageService.workspaceObject
});
await workbenchPromise;
};