import { EndOfLine , Position , Range , TextDocument , TextLine , Uri } from "vscode" ; import { DeploymentTemplateDoc , ext } from "../../extension.bundle" ; export class TextDocumentFake implements TextDocument { public constructor ( public _textBuffer , public readonly uri ) { this . fileName = uri . fsPath ; } public readonly fileName : string ; public isUntitled : boolean = false ; public languageId : string = "plain-text" ; public version : number = 0 ; public isDirty : boolean = false ; public isClosed : boolean = false ; public save ( ) { throw new Error ( "Method not implemented." ) ; } public eol : EndOfLine = ext . EOL === '\r\n' ? EndOfLine . CRLF : EndOfLine . LF ; public get lineCount ( ) : number { throw new Error ( "Method not implemented." ) ; } public lineAt ( line ) ; public lineAt ( position ) ; public lineAt ( position ) { throw new Error ( "Method not implemented." ) ; } public offsetAt ( position ) { throw new Error ( "Method not implemented." ) ; } public positionAt ( offset ) { throw new Error ( "Method not implemented." ) ; } public getText ( range ? ) { if ( range ) { const dt = new DeploymentTemplateDoc ( this . _textBuffer , this . uri , this . version ) ; const startIndex = dt . getDocumentCharacterIndex ( range . start . line , range . start . character ) ; const endIndex = dt . getDocumentCharacterIndex ( range . start . line , range . start . character ) ; return this . _textBuffer . slice ( startIndex , endIndex ) ; } else { return this . _textBuffer . slice ( ) ; } } public getWordRangeAtPosition ( position , regex ? ) { throw new Error ( "Method not implemented." ) ; } public validateRange ( range ) { throw new Error ( "Method not implemented." ) ; } public validatePosition ( position ) { throw new Error ( "Method not implemented." ) ; } }