@@ -29,7 +29,7 @@ import { snippetCompletionProvider } from './snippetCompletionProvider';
2929import { JavaClassEditorProvider } from './javaClassEditor' ;
3030import { StandardLanguageClient } from './standardLanguageClient' ;
3131import { SyntaxLanguageClient } from './syntaxLanguageClient' ;
32- import { convertToGlob , deleteDirectory , ensureExists , getBuildFilePatterns , getExclusionBlob , getInclusionPatternsFromNegatedExclusion , getJavaConfig , getJavaConfiguration , hasBuildToolConflicts } from './utils' ;
32+ import { convertToGlob , deleteClientLog , deleteDirectory , ensureExists , getBuildFilePatterns , getExclusionBlob , getInclusionPatternsFromNegatedExclusion , getJavaConfig , getJavaConfiguration , hasBuildToolConflicts } from './utils' ;
3333import glob = require( 'glob' ) ;
3434import { Telemetry } from './telemetry' ;
3535import { getMessage } from './errorUtils' ;
@@ -110,7 +110,12 @@ export async function activate(context: ExtensionContext): Promise<ExtensionAPI>
110110 if ( ! storagePath ) {
111111 storagePath = getTempWorkspace ( ) ;
112112 }
113+ const workspacePath = path . resolve ( `${ storagePath } /jdt_ws` ) ;
113114 clientLogFile = path . join ( storagePath , 'client.log' ) ;
115+ const cleanWorkspaceExists = fs . existsSync ( path . join ( workspacePath , cleanWorkspaceFileName ) ) ;
116+ if ( cleanWorkspaceExists ) {
117+ deleteClientLog ( storagePath ) ;
118+ }
114119 initializeLogFile ( clientLogFile ) ;
115120
116121 const telemetryService : Promise < TelemetryService > = Telemetry . startTelemetry ( context ) ;
@@ -137,7 +142,6 @@ export async function activate(context: ExtensionContext): Promise<ExtensionAPI>
137142 } ) . then ( async ( requirements ) => {
138143 const triggerFiles = await getTriggerFiles ( ) ;
139144 return new Promise < ExtensionAPI > ( async ( resolve ) => {
140- const workspacePath = path . resolve ( `${ storagePath } /jdt_ws` ) ;
141145 const syntaxServerWorkspacePath = path . resolve ( `${ storagePath } /ss_ws` ) ;
142146
143147 let serverMode = getJavaServerMode ( ) ;
@@ -254,7 +258,7 @@ export async function activate(context: ExtensionContext): Promise<ExtensionAPI>
254258 errorHandler : new ClientErrorHandler ( extensionName ) ,
255259 initializationFailedHandler : error => {
256260 logger . error ( `Failed to initialize ${ extensionName } due to ${ error && error . toString ( ) } ` ) ;
257- if ( error . toString ( ) . includes ( 'Connection' ) && error . toString ( ) . includes ( 'disposed' ) ) {
261+ if ( ( error . toString ( ) . includes ( 'Connection' ) && error . toString ( ) . includes ( 'disposed' ) ) || error . toString ( ) . includes ( 'Internal error ') ) {
258262 if ( ! initFailureReported ) {
259263 apiManager . fireTraceEvent ( {
260264 name : "java.client.error.initialization" ,
@@ -315,7 +319,6 @@ export async function activate(context: ExtensionContext): Promise<ExtensionAPI>
315319 }
316320 } ) ) ;
317321
318- const cleanWorkspaceExists = fs . existsSync ( path . join ( workspacePath , cleanWorkspaceFileName ) ) ;
319322 if ( cleanWorkspaceExists ) {
320323 const data = { } ;
321324 try {
@@ -1049,3 +1052,5 @@ function registerRestartJavaLanguageServerCommand(context: ExtensionContext) {
10491052 }
10501053 } ) ) ;
10511054}
1055+
1056+
0 commit comments