Skip to content

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 authored and Pierre Guillaume Herveou committed Sep 21, 2020
1 parent a90fae6 commit 0f5ed5b
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 0f5ed5b

Please sign in to comment.