@@ -5,12 +5,12 @@ import * as fs from 'fs';
5
5
import * as fse from 'fs-extra' ;
6
6
import * as os from 'os' ;
7
7
import * as path from 'path' ;
8
- import { CodeActionContext , commands , ConfigurationTarget , Diagnostic , env , EventEmitter , ExtensionContext , extensions , IndentAction , InputBoxOptions , languages , RelativePattern , TextDocument , UIKind , Uri , ViewColumn , window , workspace , WorkspaceConfiguration } from 'vscode' ;
8
+ import { CodeActionContext , commands , ConfigurationTarget , Diagnostic , env , EventEmitter , ExtensionContext , extensions , IndentAction , InputBoxOptions , languages , QuickPickItemKind , RelativePattern , TextDocument , UIKind , Uri , ViewColumn , window , workspace , WorkspaceConfiguration } from 'vscode' ;
9
9
import { CancellationToken , CodeActionParams , CodeActionRequest , Command , CompletionRequest , DidChangeConfigurationNotification , ExecuteCommandParams , ExecuteCommandRequest , LanguageClientOptions , RevealOutputChannelOn } from 'vscode-languageclient' ;
10
10
import { LanguageClient } from 'vscode-languageclient/node' ;
11
11
import { apiManager } from './apiManager' ;
12
12
import { ClientErrorHandler } from './clientErrorHandler' ;
13
- import { Commands } from './commands' ;
13
+ import { Commands , CommandTitle } from './commands' ;
14
14
import { ClientStatus , ExtensionAPI , TraceEvent } from './extension.api' ;
15
15
import * as fileEventHandler from './fileEventHandler' ;
16
16
import { getSharedIndexCache , HEAP_DUMP_LOCATION , prepareExecutable } from './javaServerStarter' ;
@@ -23,7 +23,7 @@ import { registerClientProviders } from './providerDispatcher';
23
23
import { initialize as initializeRecommendation } from './recommendation' ;
24
24
import * as requirements from './requirements' ;
25
25
import { languageStatusBarProvider } from './runtimeStatusBarProvider' ;
26
- import { serverStatusBarProvider } from './serverStatusBarProvider' ;
26
+ import { serverStatusBarProvider , ShortcutQuickPickItem } from './serverStatusBarProvider' ;
27
27
import { ACTIVE_BUILD_TOOL_STATE , cleanWorkspaceFileName , getJavaServerMode , handleTextDocumentChanges , getImportMode , onConfigurationChange , ServerMode , ImportMode } from './settings' ;
28
28
import { snippetCompletionProvider } from './snippetCompletionProvider' ;
29
29
import { JavaClassEditorProvider } from './javaClassEditor' ;
@@ -38,6 +38,7 @@ import { activationProgressNotification } from "./serverTaskPresenter";
38
38
import { loadSupportedJreNames } from './jdkUtils' ;
39
39
import { BuildFileSelector , PICKED_BUILD_FILES , cleanupProjectPickerCache } from './buildFilesSelector' ;
40
40
import { pasteFile } from './pasteAction' ;
41
+ import { ServerStatusKind } from './serverStatus' ;
41
42
42
43
const syntaxClient : SyntaxLanguageClient = new SyntaxLanguageClient ( ) ;
43
44
const standardClient : StandardLanguageClient = new StandardLanguageClient ( ) ;
@@ -343,6 +344,50 @@ export async function activate(context: ExtensionContext): Promise<ExtensionAPI>
343
344
}
344
345
345
346
// Register commands here to make it available even when the language client fails
347
+ context . subscriptions . push ( commands . registerCommand ( Commands . OPEN_STATUS_SHORTCUT , async ( status : string ) => {
348
+ const items : ShortcutQuickPickItem [ ] = [ ] ;
349
+ let statusCommand : string ;
350
+ if ( status === ServerStatusKind . error || status === ServerStatusKind . warning ) {
351
+ statusCommand = "workbench.panel.markers.view.focus" ;
352
+ } else {
353
+ statusCommand = Commands . SHOW_SERVER_TASK_STATUS ;
354
+ }
355
+
356
+ items . push ( {
357
+ label : `$(coffee) Java Status: ${ status } ` ,
358
+ command : statusCommand ,
359
+ } , {
360
+ label : "" ,
361
+ kind : QuickPickItemKind . Separator ,
362
+ command : "" ,
363
+ } , {
364
+ label : CommandTitle . OPEN_JAVA_SETTINGS ,
365
+ command : "workbench.action.openSettings" ,
366
+ args : [ "java" ] ,
367
+ } , {
368
+ label : CommandTitle . OPEN_LOGS ,
369
+ command : Commands . OPEN_LOGS ,
370
+ } , {
371
+ label : CommandTitle . CLEAN_WORKSPACE_CACHE ,
372
+ command : Commands . CLEAN_WORKSPACE
373
+ } ) ;
374
+
375
+ const choice = await window . showQuickPick ( items ) ;
376
+ if ( ! choice ) {
377
+ return ;
378
+ }
379
+
380
+ apiManager . fireTraceEvent ( {
381
+ name : "triggerShortcutCommand" ,
382
+ properties : {
383
+ message : choice . command ,
384
+ } ,
385
+ } ) ;
386
+
387
+ if ( choice . command ) {
388
+ commands . executeCommand ( choice . command , ...( choice . args || [ ] ) ) ;
389
+ }
390
+ } ) ) ;
346
391
context . subscriptions . push ( commands . registerCommand ( Commands . OPEN_SERVER_LOG , ( column : ViewColumn ) => openServerLogFile ( storagePath , column ) ) ) ;
347
392
context . subscriptions . push ( commands . registerCommand ( Commands . OPEN_SERVER_STDOUT_LOG , ( column : ViewColumn ) => openRollingServerLogFile ( storagePath , '.out-jdt.ls' , column ) ) ) ;
348
393
context . subscriptions . push ( commands . registerCommand ( Commands . OPEN_SERVER_STDERR_LOG , ( column : ViewColumn ) => openRollingServerLogFile ( storagePath , '.error-jdt.ls' , column ) ) ) ;
@@ -510,7 +555,7 @@ async function startStandardServer(context: ExtensionContext, requirements: requ
510
555
standardClient . start ( ) . then ( async ( ) => {
511
556
standardClient . registerLanguageClientActions ( context , await fse . pathExists ( path . join ( workspacePath , ".metadata" , ".plugins" ) ) , jdtEventEmitter ) ;
512
557
} ) ;
513
- serverStatusBarProvider . showStandardStatus ( ) ;
558
+ serverStatusBarProvider . setBusy ( "Activating..." ) ;
514
559
}
515
560
516
561
async function workspaceContainsBuildFiles ( ) : Promise < boolean > {
0 commit comments