license import * as vscode from 'coc.nvim' ; export const ANGULAR_SCHEME = 'ng' ; export class TcbContentProvider { private srcId = 'ng-tcb-range' ; private uri : string ; private buffer : vscode . Buffer ; async update ( uri , content ) { if ( ! this . buffer || ! ( await this . buffer . valid ) ) { this . buffer = await vscode . workspace . nvim . createNewBuffer ( false , true ) ; await this . buffer . setVar ( 'coc_enabled' , 0 ) ; await this . buffer . setOption ( 'buftype' , 'nofile' ) ; } if ( this . uri !== uri . toString ( ) ) { this . uri = uri . toString ( ) ; await this . buffer . setName ( this . uri ) ; await this . buffer . setOption ( 'filetype' , 'typescript' ) ; } await this . buffer . setLines ( content . split ( '\n' ) , { start : 0 , end : - 1 , strictIndexing : false } ) ; await this . buffer . setOption ( 'modified' , false ) ; } async show ( ranges ? ) { await vscode . workspace . nvim . command ( `tabnew ${ this . uri }` ) ; if ( ranges && ranges . length ) { const w = await vscode . workspace . nvim . window ; this . buffer . highlightRanges ( this . srcId , 'Visual' , ranges ) ; await w . setCursor ( [ ranges [ 0 ] . start . line + 1 , ranges [ 0 ] . start . character ] ) ; } } }