parent
1b0a962c0d
commit
670b13798a
|
@ -6,7 +6,6 @@ import { upload } from "./upload";
|
||||||
import { client } from "./fill/client";
|
import { client } from "./fill/client";
|
||||||
import { clipboard } from "./fill/clipboard";
|
import { clipboard } from "./fill/clipboard";
|
||||||
import { INotificationService, IProgressService } from "./fill/notification";
|
import { INotificationService, IProgressService } from "./fill/notification";
|
||||||
import { IURIFactory } from "./fill/uri";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A general abstraction of an IDE client.
|
* A general abstraction of an IDE client.
|
||||||
|
@ -19,7 +18,6 @@ import { IURIFactory } from "./fill/uri";
|
||||||
export abstract class IdeClient {
|
export abstract class IdeClient {
|
||||||
public readonly retry = retry;
|
public readonly retry = retry;
|
||||||
public readonly clipboard = clipboard;
|
public readonly clipboard = clipboard;
|
||||||
public readonly uriFactory: IURIFactory;
|
|
||||||
public readonly upload = upload;
|
public readonly upload = upload;
|
||||||
|
|
||||||
private start: Time | undefined;
|
private start: Time | undefined;
|
||||||
|
@ -47,8 +45,6 @@ export abstract class IdeClient {
|
||||||
logger.info("Unloaded");
|
logger.info("Unloaded");
|
||||||
});
|
});
|
||||||
|
|
||||||
this.uriFactory = this.createUriFactory();
|
|
||||||
|
|
||||||
this.initialize().then(() => {
|
this.initialize().then(() => {
|
||||||
logger.info("Load completed", field("duration", this.loadTime));
|
logger.info("Load completed", field("duration", this.loadTime));
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
|
@ -134,9 +130,4 @@ export abstract class IdeClient {
|
||||||
* Initialize the IDE.
|
* Initialize the IDE.
|
||||||
*/
|
*/
|
||||||
protected abstract initialize(): Promise<void>;
|
protected abstract initialize(): Promise<void>;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create URI factory.
|
|
||||||
*/
|
|
||||||
protected abstract createUriFactory(): IURIFactory;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
export interface IURI {
|
|
||||||
readonly path: string;
|
|
||||||
readonly fsPath: string;
|
|
||||||
readonly scheme: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IURIFactory {
|
|
||||||
/**
|
|
||||||
* Convert the object to an instance of a real URI.
|
|
||||||
*/
|
|
||||||
create<T extends IURI>(uri: IURI): T;
|
|
||||||
file(path: string): IURI;
|
|
||||||
parse(raw: string): IURI;
|
|
||||||
}
|
|
|
@ -1,6 +1,5 @@
|
||||||
export * from "./client";
|
export * from "./client";
|
||||||
export * from "./fill/clipboard";
|
export * from "./fill/clipboard";
|
||||||
export * from "./fill/notification";
|
export * from "./fill/notification";
|
||||||
export * from "./fill/uri";
|
|
||||||
export * from "./retry";
|
export * from "./retry";
|
||||||
export * from "./upload";
|
export * from "./upload";
|
||||||
|
|
|
@ -3,9 +3,14 @@ import { appendFile } from "fs";
|
||||||
import { promisify } from "util";
|
import { promisify } from "util";
|
||||||
import { logger, Logger } from "@coder/logger";
|
import { logger, Logger } from "@coder/logger";
|
||||||
import { escapePath } from "@coder/protocol";
|
import { escapePath } from "@coder/protocol";
|
||||||
import { IURI } from "./fill/uri";
|
|
||||||
import { NotificationService, INotificationService, ProgressService, IProgressService, IProgress, Severity } from "./fill/notification";
|
import { NotificationService, INotificationService, ProgressService, IProgressService, IProgress, Severity } from "./fill/notification";
|
||||||
|
|
||||||
|
export interface IURI {
|
||||||
|
readonly path: string;
|
||||||
|
readonly fsPath: string;
|
||||||
|
readonly scheme: string;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an uploadable directory, so we can query for existing files once.
|
* Represents an uploadable directory, so we can query for existing files once.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -12,7 +12,7 @@ import "./fill/workbenchRegistry";
|
||||||
import { PasteAction } from "./fill/paste";
|
import { PasteAction } from "./fill/paste";
|
||||||
import "./fill/dom";
|
import "./fill/dom";
|
||||||
import "./vscode.scss";
|
import "./vscode.scss";
|
||||||
import { IdeClient, IURI, IURIFactory, IProgress, INotificationHandle } from "@coder/ide";
|
import { IdeClient, IProgress, INotificationHandle } from "@coder/ide";
|
||||||
import { registerContextMenuListener } from "vs/base/parts/contextmenu/electron-main/contextmenu";
|
import { registerContextMenuListener } from "vs/base/parts/contextmenu/electron-main/contextmenu";
|
||||||
import { LogLevel } from "vs/platform/log/common/log";
|
import { LogLevel } from "vs/platform/log/common/log";
|
||||||
import { URI } from "vs/base/common/uri";
|
import { URI } from "vs/base/common/uri";
|
||||||
|
@ -144,16 +144,6 @@ export class Client extends IdeClient {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected createUriFactory(): IURIFactory {
|
|
||||||
return {
|
|
||||||
// TODO: not sure why this is an error.
|
|
||||||
// tslint:disable-next-line no-any
|
|
||||||
create: <URI>(uri: IURI): URI => URI.from(uri) as any,
|
|
||||||
file: (path: string): IURI => URI.file(path),
|
|
||||||
parse: (raw: string): IURI => URI.parse(raw),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected initialize(): Promise<void> {
|
protected initialize(): Promise<void> {
|
||||||
registerContextMenuListener();
|
registerContextMenuListener();
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
"no-redundant-jsdoc": true,
|
"no-redundant-jsdoc": true,
|
||||||
"no-implicit-dependencies": false,
|
"no-implicit-dependencies": false,
|
||||||
"no-boolean-literal-compare": true,
|
"no-boolean-literal-compare": true,
|
||||||
|
"prefer-readonly": true,
|
||||||
"deprecation": true,
|
"deprecation": true,
|
||||||
"semicolon": true,
|
"semicolon": true,
|
||||||
"one-line": [
|
"one-line": [
|
||||||
|
|
Loading…
Reference in New Issue