Make getSupportedCodeFixes plugin test such that we dont need to update its baseline for every new error (#53070)

This commit is contained in:
Sheetal Nandi
2023-03-02 14:58:13 -08:00
committed by GitHub
parent 40cd0de05b
commit b19cfc03f2
4 changed files with 8 additions and 1227 deletions

View File

@@ -49,6 +49,7 @@ function createCodeFixActionWorker(fixName: string, description: string, changes
/** @internal */
export function registerCodeFix(reg: CodeFixRegistration) {
for (const error of reg.errorCodes) {
errorCodeToFixesArray = undefined;
errorCodeToFixes.add(String(error), reg);
}
if (reg.fixIds) {
@@ -59,9 +60,10 @@ export function registerCodeFix(reg: CodeFixRegistration) {
}
}
let errorCodeToFixesArray: readonly string[] | undefined;
/** @internal */
export function getSupportedErrorCodes(): readonly string[] {
return arrayFrom(errorCodeToFixes.keys());
return errorCodeToFixesArray ??= arrayFrom(errorCodeToFixes.keys());
}
function removeFixIdIfFixAllUnavailable(registration: CodeFixRegistration, diagnostics: Diagnostic[]) {