import * as vscode from 'vscode' ; import { QueryResults } from './database' ; import { Global } from './global' ; export class OutputChannel { private static outputChannel = vscode . window . createOutputChannel ( 'PostgreSQL' ) ; public static show ( ) { OutputChannel . outputChannel . show ( true ) ; } public static appendLine ( value , show ? ) { if ( show ) OutputChannel . outputChannel . show ( true ) ; OutputChannel . outputChannel . appendLine ( value ) ; } public static displayResults ( uri , title , res , showInCurrentPanel = false ) { let viewColumn = OutputChannel . getViewColumn ( ) ; if ( showInCurrentPanel ) viewColumn -= 1 ; Global . ResultManager . showResults ( uri , viewColumn , res ) ; } public static displayMessage ( uri , title , message , showInCurrentPanel = false ) { let msgRes = new Array < QueryResults > ( ) ; msgRes . push ( { rowCount : 0 , command : 'ext-message' , message : message } ) ; this . displayResults ( uri , title , msgRes , showInCurrentPanel ) ; } private static getViewColumn ( ) { const resourceColumn = ( vscode . window . activeTextEditor && vscode . window . activeTextEditor . viewColumn ) || vscode . ViewColumn . One ; return resourceColumn + 1 ; } }