From 3ac9d6edfb73fbfc534b6d3c21cd136cec19ba55 Mon Sep 17 00:00:00 2001 From: Andrey Kuzmin Date: Fri, 26 Jan 2024 12:48:09 +0100 Subject: [PATCH] Fix the issue with the missing diagnostic.data --- src/common/providers/codeActionProvider.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/common/providers/codeActionProvider.ts b/src/common/providers/codeActionProvider.ts index 41959973..0779edae 100644 --- a/src/common/providers/codeActionProvider.ts +++ b/src/common/providers/codeActionProvider.ts @@ -293,6 +293,12 @@ export class CodeActionProvider { // and the fix all code action for that error if there are other diagnostics with // the same error code (params.context.diagnostics).forEach((diagnostic) => { + // We have type casted diagnostic to `IDiagnostic`, however the original + // type is `Diagnostic`, the `.data` property may be missing in some cases + if (!diagnostic.data) { + return; + } + const registrations = CodeActionProvider.errorCodeToRegistrationMap.getAll( diagnostic.data.code,