Skip to content
This repository has been archived by the owner on Nov 5, 2021. It is now read-only.

Commit

Permalink
Fixes microsoft/monaco-editor#1638: Protect against failing `getCodeF…
Browse files Browse the repository at this point in the history
…ixesAtPosition` calls
  • Loading branch information
alexdima committed Sep 18, 2020
1 parent 8381cb3 commit 0ac03ae
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/tsWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,18 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, ITypeScriptWork
formatOptions: ts.FormatCodeOptions
): Promise<ReadonlyArray<ts.CodeFixAction>> {
const preferences = {};
return this._languageService.getCodeFixesAtPosition(
fileName,
start,
end,
errorCodes,
formatOptions,
preferences
);
try {
return this._languageService.getCodeFixesAtPosition(
fileName,
start,
end,
errorCodes,
formatOptions,
preferences
);
} catch {
return [];
}
}

async updateExtraLibs(extraLibs: IExtraLibs): Promise<void> {
Expand Down

0 comments on commit 0ac03ae

Please sign in to comment.