From 15f814d92d924e49d15b5ee3fbb71b3757109f57 Mon Sep 17 00:00:00 2001 From: johnsoncodehk Date: Tue, 6 Sep 2022 07:31:28 +0800 Subject: [PATCH] fix: only cache no error sfc https://github.com/johnsoncodehk/volar/issues/1807#issuecomment-1236857296 --- packages/vue-language-core/src/sourceFile.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/vue-language-core/src/sourceFile.ts b/packages/vue-language-core/src/sourceFile.ts index e3e9cb914..6a0fdc3c9 100644 --- a/packages/vue-language-core/src/sourceFile.ts +++ b/packages/vue-language-core/src/sourceFile.ts @@ -151,11 +151,13 @@ export function createSourceFile( for (const plugin of plugins) { const sfc = plugin.parseSFC?.(fileName, fileContent.value); if (sfc) { - parsedSfcCache = { - snapshot: snapshot.value, - sfc, - plugin, - }; + if (!sfc.errors.length) { + parsedSfcCache = { + snapshot: snapshot.value, + sfc, + plugin, + }; + } return sfc; } }