@@ -369,6 +369,8 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
369
369
370
370
// Register commands here to make it available even when the language client fails
371
371
context . subscriptions . push ( commands . registerCommand ( Commands . OPEN_SERVER_LOG , ( column : ViewColumn ) => openServerLogFile ( workspacePath , column ) ) ) ;
372
+ context . subscriptions . push ( commands . registerCommand ( Commands . OPEN_SERVER_STDOUT_LOG , ( column : ViewColumn ) => openRollingServerLogFile ( workspacePath , '.out-jdt.ls' , column ) ) ) ;
373
+ context . subscriptions . push ( commands . registerCommand ( Commands . OPEN_SERVER_STDERR_LOG , ( column : ViewColumn ) => openRollingServerLogFile ( workspacePath , '.error-jdt.ls' , column ) ) ) ;
372
374
373
375
context . subscriptions . push ( commands . registerCommand ( Commands . OPEN_CLIENT_LOG , ( column : ViewColumn ) => openClientLogFile ( clientLogFile , column ) ) ) ;
374
376
@@ -734,6 +736,25 @@ function openServerLogFile(workspacePath, column: ViewColumn = ViewColumn.Active
734
736
return openLogFile ( serverLogFile , 'Could not open Java Language Server log file' , column ) ;
735
737
}
736
738
739
+ function openRollingServerLogFile ( workspacePath , filename , column : ViewColumn = ViewColumn . Active ) : Thenable < boolean > {
740
+ return new Promise ( ( resolve ) => {
741
+ const dirname = path . join ( workspacePath , '.metadata' ) ;
742
+
743
+ // find out the newest one
744
+ glob ( filename + '-*' , { cwd : dirname } , ( err , files ) => {
745
+ if ( ! err && files . length > 0 ) {
746
+ files . sort ( ) ;
747
+
748
+ const logFile = path . join ( dirname , files [ files . length - 1 ] ) ;
749
+ openLogFile ( logFile , `Could not open Java Language Server log file ${ filename } ` , column ) . then ( ( result ) => resolve ( result ) ) ;
750
+ } else {
751
+ window . showWarningMessage ( `Could not find Java Language Server log file ${ filename } in ${ dirname } ` ) ;
752
+ resolve ( false ) ;
753
+ }
754
+ } ) ;
755
+ } ) ;
756
+ }
757
+
737
758
function openClientLogFile ( logFile : string , column : ViewColumn = ViewColumn . Active ) : Thenable < boolean > {
738
759
return new Promise ( ( resolve ) => {
739
760
const filename = path . basename ( logFile ) ;
@@ -765,7 +786,9 @@ function openClientLogFile(logFile: string, column: ViewColumn = ViewColumn.Acti
765
786
766
787
async function openLogs ( ) {
767
788
await commands . executeCommand ( Commands . OPEN_CLIENT_LOG , ViewColumn . One ) ;
768
- await commands . executeCommand ( Commands . OPEN_SERVER_LOG , ViewColumn . Two ) ;
789
+ await commands . executeCommand ( Commands . OPEN_SERVER_LOG , ViewColumn . One ) ;
790
+ await commands . executeCommand ( Commands . OPEN_SERVER_STDOUT_LOG , ViewColumn . One ) ;
791
+ await commands . executeCommand ( Commands . OPEN_SERVER_STDERR_LOG , ViewColumn . One ) ;
769
792
}
770
793
771
794
function openLogFile ( logFile , openingFailureWarning : string , column : ViewColumn = ViewColumn . Active ) : Thenable < boolean > {
@@ -778,7 +801,7 @@ function openLogFile(logFile, openingFailureWarning: string, column: ViewColumn
778
801
if ( ! doc ) {
779
802
return false ;
780
803
}
781
- return window . showTextDocument ( doc , column )
804
+ return window . showTextDocument ( doc , { viewColumn : column , preview : false } )
782
805
. then ( editor => ! ! editor ) ;
783
806
} , ( ) => false )
784
807
. then ( didOpen => {
0 commit comments