@@ -25,8 +25,9 @@ import { getJavaConfiguration } from './utils';
2525import { onConfigurationChange , excludeProjectSettingsFiles } from './settings' ;
2626import { logger , initializeLogFile } from './log' ;
2727import glob = require( 'glob' ) ;
28+ import { serverTasks } from './serverTasks' ;
29+ import { serverTaskPresenter } from './serverTaskPresenter' ;
2830
29- let lastStatus ;
3031let languageClient : LanguageClient ;
3132const jdtEventEmitter = new EventEmitter < Uri > ( ) ;
3233const cleanWorkspaceFileName = '.cleanWorkspace' ;
@@ -180,8 +181,9 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
180181
181182 const item = window . createStatusBarItem ( StatusBarAlignment . Right , Number . MIN_VALUE ) ;
182183 item . text = '$(sync~spin)' ;
183- item . command = Commands . OPEN_OUTPUT ;
184- const progressBar = window . createStatusBarItem ( StatusBarAlignment . Left , Number . MIN_VALUE + 1 ) ;
184+ item . command = Commands . SHOW_SERVER_TASK_STATUS ;
185+
186+ commands . executeCommand ( Commands . SHOW_SERVER_TASK_STATUS ) ;
185187
186188 let serverOptions ;
187189 const port = process . env [ 'SERVER_PORT' ] ;
@@ -215,8 +217,6 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
215217 switch ( report . type ) {
216218 case 'Started' :
217219 item . text = '$(thumbsup)' ;
218- p . report ( { message : 'Finished' } ) ;
219- lastStatus = item . text ;
220220 commands . executeCommand ( 'setContext' , 'javaLSReady' , true ) ;
221221 resolve ( {
222222 apiVersion : ExtensionApiVersion ,
@@ -228,8 +228,6 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
228228 break ;
229229 case 'Error' :
230230 item . text = '$(thumbsdown)' ;
231- lastStatus = item . text ;
232- p . report ( { message : 'Finished with Error' } ) ;
233231 toggleItem ( window . activeTextEditor , item ) ;
234232 resolve ( {
235233 apiVersion : ExtensionApiVersion ,
@@ -240,22 +238,15 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
240238 } ) ;
241239 break ;
242240 case 'Starting' :
243- p . report ( { message : report . message } ) ;
244- break ;
245241 case 'Message' :
246- item . text = report . message ;
247- setTimeout ( ( ) => { item . text = lastStatus ; } , 3000 ) ;
242+ // message goes to progress report instead
248243 break ;
249244 }
250245 item . tooltip = report . message ;
251246 toggleItem ( window . activeTextEditor , item ) ;
252247 } ) ;
253248 languageClient . onNotification ( ProgressReportNotification . type , ( progress ) => {
254- progressBar . show ( ) ;
255- progressBar . text = progress . status ;
256- if ( progress . complete ) {
257- setTimeout ( ( ) => { progressBar . hide ( ) ; } , 500 ) ;
258- }
249+ serverTasks . updateServerTask ( progress ) ;
259250 } ) ;
260251 languageClient . onNotification ( ActionableNotification . type , ( notification ) => {
261252 let show = null ;
@@ -441,6 +432,8 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
441432
442433 context . subscriptions . push ( commands . registerCommand ( Commands . CLEAN_WORKSPACE , ( ) => cleanWorkspace ( workspacePath ) ) ) ;
443434
435+ context . subscriptions . push ( commands . registerCommand ( Commands . SHOW_SERVER_TASK_STATUS , ( ) => serverTaskPresenter . presentServerTaskView ( ) ) ) ;
436+
444437 context . subscriptions . push ( onConfigurationChange ( languageClient , context ) ) ;
445438 toggleItem ( window . activeTextEditor , item ) ;
446439 } ) ;
0 commit comments