import * as vscode from 'vscode' ; import { Disposable } from '../../utils/dispose' ; import { SettingUtil } from '../../utils/settingsUtil' ; description export class StatusBarNotifier extends Disposable { private _statusBar : vscode . StatusBarItem ; private _extensionUri : vscode . Uri ; private _on : boolean ; constructor ( extensionUri ) { super ( ) ; this . _statusBar = this . _register ( vscode . window . createStatusBarItem ( vscode . StatusBarAlignment . Right , 100 ) ) ; this . _extensionUri = extensionUri ; this . ServerOff ( ) ; this . _on = false ; } description public ServerOn ( port ) { this . _on = true ; if ( SettingUtil . GetConfig ( this . _extensionUri ) . showStatusBarItem ) { this . _statusBar . show ( ) ; } this . _statusBar . text = `$(radio-tower) Port: ${ port }` ; this . _statusBar . tooltip = `Live Preview running on port ${ port }` ; this . _statusBar . command = { title : 'Open Command Palette' , command : 'workbench.action.quickOpen' , arguments : [ '>Live Preview: ' ] , } ; } description public ServerOff ( ) { this . _on = false ; this . _statusBar . hide ( ) ; } description public updateConfigurations ( ) { if ( SettingUtil . GetConfig ( this . _extensionUri ) . showStatusBarItem ) { if ( this . _on ) { this . _statusBar . show ( ) ; } } else { this . _statusBar . hide ( ) ; } } }