@@ -21,7 +21,7 @@ import { regExpFlags } from 'vs/base/common/strings';
2121import { isNonEmptyArray } from 'vs/base/common/arrays' ;
2222import { ILogService } from 'vs/platform/log/common/log' ;
2323import { StopWatch } from 'vs/base/common/stopwatch' ;
24- import { canceled } from 'vs/base/common/errors' ;
24+ import { canceled , onUnexpectedError } from 'vs/base/common/errors' ;
2525import { UnicodeHighlighterOptions } from 'vs/editor/common/services/unicodeTextModelHighlighter' ;
2626import { IEditorWorkerHost } from 'vs/editor/common/services/editorWorkerHost' ;
2727import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures' ;
@@ -153,7 +153,11 @@ export class EditorWorkerService extends Disposable implements IEditorWorkerServ
153153 return Promise . resolve ( edits ) ; // File too large
154154 }
155155 const sw = StopWatch . create ( true ) ;
156- const result = this . _workerManager . withWorker ( ) . then ( client => client . computeHumanReadableDiff ( resource , edits ) ) ;
156+ const result = this . _workerManager . withWorker ( ) . then ( client => client . computeHumanReadableDiff ( resource , edits ) ) . catch ( ( err ) => {
157+ onUnexpectedError ( err ) ;
158+ // In case of an exception, fall back to computeMoreMinimalEdits
159+ return this . computeMoreMinimalEdits ( resource , edits , true ) ;
160+ } ) ;
157161 result . finally ( ( ) => this . _logService . trace ( 'FORMAT#computeHumanReadableDiff' , resource . toString ( true ) , sw . elapsed ( ) ) ) ;
158162 return Promise . race ( [ result , timeout ( 1000 ) . then ( ( ) => edits ) ] ) ;
159163
0 commit comments