diff --git a/packages/language-server/src/plugins/svelte/features/getDiagnostics.ts b/packages/language-server/src/plugins/svelte/features/getDiagnostics.ts index f46158ea5..192622799 100644 --- a/packages/language-server/src/plugins/svelte/features/getDiagnostics.ts +++ b/packages/language-server/src/plugins/svelte/features/getDiagnostics.ts @@ -91,6 +91,13 @@ async function createParserErrorDiagnostic(error: any, document: Document) { document.scriptInfo || document.moduleScriptInfo ); + if (!document.config?.preprocess && document.getText().includes('lang="')) { + Logger.error( + `Parsing ${document.getFilePath()} failed. No preprocess config found but lang tag exists. Skip showing error because they likely use other preprocessors.` + ); + return []; + } + if (isInStyle || isInScript) { diagnostic.message += '\n\nIf you expect this syntax to work, here are some suggestions: ';