From 381ba6d797e8b70a2c743eb40a422f826e463d46 Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Mon, 27 Sep 2021 09:43:55 +0200 Subject: [PATCH 1/2] (fix) adjust error message suggest lang="ts" instead of lang="typescript" as the former is more common, shorter, and right now Vite does not support the latter --- .../src/plugins/svelte/features/getDiagnostics.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/language-server/src/plugins/svelte/features/getDiagnostics.ts b/packages/language-server/src/plugins/svelte/features/getDiagnostics.ts index d67652c69..0c58e0de5 100644 --- a/packages/language-server/src/plugins/svelte/features/getDiagnostics.ts +++ b/packages/language-server/src/plugins/svelte/features/getDiagnostics.ts @@ -96,7 +96,7 @@ async function createParserErrorDiagnostic(error: any, document: Document) { '\n\nIf you expect this syntax to work, here are some suggestions: '; if (isInScript) { diagnostic.message += - '\nIf you use typescript with `svelte-preprocess`, did you add `lang="typescript"` to your `script` tag? '; + '\nIf you use typescript with `svelte-preprocess`, did you add `lang="ts"` to your `script` tag? '; } else { diagnostic.message += '\nIf you use less/SCSS with `svelte-preprocess`, did you add `lang="scss"`/`lang="less"` to you `style` tag? ' + From 2d125fa4ed810a192d485da71ba6cab962e26ded Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Mon, 27 Sep 2021 09:46:41 +0200 Subject: [PATCH 2/2] test --- .../test/plugins/svelte/features/getDiagnostics.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/language-server/test/plugins/svelte/features/getDiagnostics.test.ts b/packages/language-server/test/plugins/svelte/features/getDiagnostics.test.ts index 0a7f06eb2..eeb3cd897 100644 --- a/packages/language-server/test/plugins/svelte/features/getDiagnostics.test.ts +++ b/packages/language-server/test/plugins/svelte/features/getDiagnostics.test.ts @@ -219,7 +219,7 @@ describe('SveltePlugin#getDiagnostics', () => { message: 'expected x to not be here' + '\n\nIf you expect this syntax to work, here are some suggestions: ' + - '\nIf you use typescript with `svelte-preprocess`, did you add `lang="typescript"` to your `script` tag? ' + + '\nIf you use typescript with `svelte-preprocess`, did you add `lang="ts"` to your `script` tag? ' + '\nDid you setup a `svelte.config.js`? ' + '\nSee https://github.com/sveltejs/language-tools/tree/master/docs#using-with-preprocessors for more info.', range: {