export class Window { public state: any = { focused: true }; public onDidChangeWindowState(event: any) {} public onDidChangeActiveColorTheme(event: any) {} } export class Workspace { public onDidOpenTextDocument(event: any) {} public onDidCloseTextDocument(event: any) {} public onDidChangeTextDocument(event: any) {} public onDidSaveTextDocument(event: any) {} } export class Env { public clipboard: any = { readText: async () => { return ''; } } } export class Disposable { constructor() {} from(...disposableLikes: { dispose: () => any }[]): any { return {}; } dispose(): any {} } export class TextDocument { uri: Uri = new Uri('', '', ''); fileName: string = ""; isUntitled: boolean = false; languageId: string = ""; version: number = 0; isDirty: boolean = false; isClosed: boolean = false; eol: EndOfLine = EndOfLine.CRLF; lineCount: number = 0; constructor(fileName: string) { this.fileName = fileName; this.uri = new Uri('file', `uri-fs-path:${fileName}`, `path:${fileName}`); this.isUntitled = false; } } export class TextDocumentChangeEvent { document: TextDocument = new TextDocument(''); contentChanges: TextDocumentContentChangeEvent[] = []; reason?: TextDocumentChangeReason = TextDocumentChangeReason.Redo; } export class Uri { scheme: string = ""; authority: string = ""; path: string = "" query: string = ""; fragment: string = ""; fsPath: string = ""; constructor(scheme: string, fsPath: string, path: string) { this.scheme = scheme; this.fsPath = fsPath; this.path = path; } } export class TextDocumentContentChangeEvent { /** * The range that got replaced. */ range: Range = new Range(new Position(0, 0), new Position(0, 0)); /** * The offset of the range that got replaced. */ rangeOffset: number = 0; /** * The length of the range that got replaced. */ rangeLength: number = 0; /** * The new text for the range. */ text: string = ''; } export class Position { line: number = 0; character: number = 0; constructor(line: number, character: number) { this.line = line; this.character = character; } } export class Range { start: Position = new Position(0, 0); end: Position = new Position(0, 0); constructor(start: Position, end: Position) { this.start = start; this.end = end; } } export enum EndOfLine { /** * The line feed `\n` character. */ LF = 1, /** * The carriage return line feed `\r\n` sequence. */ CRLF = 2 } export enum TextDocumentChangeReason { /** The text change is caused by an undo operation. */ Undo = 1, /** The text change is caused by an redo operation. */ Redo = 2, }