import * as vscode from "vscode" ; /**
 * Output channel with colorized message
 */ export class ColorizedChannel { param operation param error static formatMessage ( operation , error ? ) { if ( error ) { const message = operation . charAt ( 0 ) . toLowerCase ( ) + operation . slice ( 1 ) ; return `Fail to ${ message }. Error: ${ error . message }` ; } else { return `${ operation } successfully` ; } } param name private static createTag ( name ) { return name ? `[${ name }]` : "" ; } private channel : vscode . OutputChannel ; constructor ( name ) { this . channel = vscode . window . createOutputChannel ( name ) ; } param operation param component start ( operation , component ? ) { const tag = ColorizedChannel . createTag ( component ) ; this . channel . appendLine ( `[Start]${ tag } ${ operation }` ) ; } param operation param component end ( operation , component ? ) { const tag = ColorizedChannel . createTag ( component ) ; this . channel . appendLine ( `[Done]${ tag } ${ ColorizedChannel . formatMessage ( operation ) }` ) ; } param operation info ( message ) { this . channel . appendLine ( message ) ; } param operation param component warn ( message , component ? ) { const tag = ColorizedChannel . createTag ( component ) ; this . channel . appendLine ( `[Warn]${ tag } ${ message }` ) ; } param operation param component param error error ( operation , component ? , error ? ) { const tag = ColorizedChannel . createTag ( component ) ; const message = error ? ColorizedChannel . formatMessage ( operation , error ) : operation ; this . channel . appendLine ( `[Error]${ tag } ${ message }` ) ; } /**
     * show channel
     */ show ( ) { this . channel . show ( ) ; } /**
     * dispose channel
     */ dispose ( ) { if ( this . channel ) { this . channel . dispose ( ) ; } } }