diff --git a/packages/ide/src/client.ts b/packages/ide/src/client.ts index 4cc659b89..ce600c713 100644 --- a/packages/ide/src/client.ts +++ b/packages/ide/src/client.ts @@ -6,7 +6,6 @@ import { upload } from "./upload"; import { client } from "./fill/client"; import { clipboard } from "./fill/clipboard"; import { INotificationService, IProgressService } from "./fill/notification"; -import { IURIFactory } from "./fill/uri"; /** * A general abstraction of an IDE client. @@ -19,7 +18,6 @@ import { IURIFactory } from "./fill/uri"; export abstract class IdeClient { public readonly retry = retry; public readonly clipboard = clipboard; - public readonly uriFactory: IURIFactory; public readonly upload = upload; private start: Time | undefined; @@ -47,8 +45,6 @@ export abstract class IdeClient { logger.info("Unloaded"); }); - this.uriFactory = this.createUriFactory(); - this.initialize().then(() => { logger.info("Load completed", field("duration", this.loadTime)); }).catch((error) => { @@ -134,9 +130,4 @@ export abstract class IdeClient { * Initialize the IDE. */ protected abstract initialize(): Promise; - - /** - * Create URI factory. - */ - protected abstract createUriFactory(): IURIFactory; } diff --git a/packages/ide/src/fill/uri.ts b/packages/ide/src/fill/uri.ts deleted file mode 100644 index d3192ee34..000000000 --- a/packages/ide/src/fill/uri.ts +++ /dev/null @@ -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(uri: IURI): T; - file(path: string): IURI; - parse(raw: string): IURI; -} diff --git a/packages/ide/src/index.ts b/packages/ide/src/index.ts index 9d3493fbe..5c75fbb15 100644 --- a/packages/ide/src/index.ts +++ b/packages/ide/src/index.ts @@ -1,6 +1,5 @@ export * from "./client"; export * from "./fill/clipboard"; export * from "./fill/notification"; -export * from "./fill/uri"; export * from "./retry"; export * from "./upload"; diff --git a/packages/ide/src/upload.ts b/packages/ide/src/upload.ts index 8faf19174..03305f6ff 100644 --- a/packages/ide/src/upload.ts +++ b/packages/ide/src/upload.ts @@ -3,9 +3,14 @@ import { appendFile } from "fs"; import { promisify } from "util"; import { logger, Logger } from "@coder/logger"; import { escapePath } from "@coder/protocol"; -import { IURI } from "./fill/uri"; 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. */ diff --git a/packages/vscode/src/client.ts b/packages/vscode/src/client.ts index 98412764e..2488912b0 100644 --- a/packages/vscode/src/client.ts +++ b/packages/vscode/src/client.ts @@ -12,7 +12,7 @@ import "./fill/workbenchRegistry"; import { PasteAction } from "./fill/paste"; import "./fill/dom"; 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 { LogLevel } from "vs/platform/log/common/log"; 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: IURI): URI => URI.from(uri) as any, - file: (path: string): IURI => URI.file(path), - parse: (raw: string): IURI => URI.parse(raw), - }; - } - protected initialize(): Promise { registerContextMenuListener(); diff --git a/tslint.json b/tslint.json index 0b4bc8e43..7edd84307 100644 --- a/tslint.json +++ b/tslint.json @@ -26,6 +26,7 @@ "no-redundant-jsdoc": true, "no-implicit-dependencies": false, "no-boolean-literal-compare": true, + "prefer-readonly": true, "deprecation": true, "semicolon": true, "one-line": [