diff --git a/packages/language-server/src/plugins/svelte/SveltePlugin.ts b/packages/language-server/src/plugins/svelte/SveltePlugin.ts index 83ff1bf3c..fad2fc897 100644 --- a/packages/language-server/src/plugins/svelte/SveltePlugin.ts +++ b/packages/language-server/src/plugins/svelte/SveltePlugin.ts @@ -103,7 +103,7 @@ export class SveltePlugin const config1 = await getConfig(prettier1); const resolvedPlugins1 = resolvePlugins(config1.plugins); const pluginLoaded = await hasSveltePluginLoaded(prettier1, resolvedPlugins1); - if (Number(prettier1.version[0]) < 3 || pluginLoaded) { + if (Number(prettier1.version[0]) >= 3 || pluginLoaded) { // plugin loaded, or referenced in user config as a plugin, or same version as our fallback version -> ok return { prettier: prettier1, diff --git a/packages/language-server/test/plugins/svelte/SveltePlugin.test.ts b/packages/language-server/test/plugins/svelte/SveltePlugin.test.ts index 420098603..db5d5e7d4 100644 --- a/packages/language-server/test/plugins/svelte/SveltePlugin.test.ts +++ b/packages/language-server/test/plugins/svelte/SveltePlugin.test.ts @@ -238,7 +238,7 @@ describe('Svelte Plugin', () => { ); }); - it('should load the user prettier version (version 3)', async () => { + it('should load the user prettier version (version 2)', async () => { function stubPrettier(config: any) { const formatStub = sinon.stub().returns(Promise.resolve('formatted')); @@ -246,7 +246,7 @@ describe('Svelte Plugin', () => { .stub(importPackage, 'importPrettier') .onFirstCall() .returns({ - version: '3.0.0', + version: '2.0.0', resolveConfig: () => Promise.resolve(config), getFileInfo: () => ({ ignored: false }), format: formatStub, @@ -275,7 +275,7 @@ describe('Svelte Plugin', () => { .stub(importPackage, 'importPrettier') .onFirstCall() .returns({ - version: '3.0.0', + version: '2.8.0', resolveConfig: () => Promise.resolve(config), getFileInfo: () => ({ ignored: false }), format: () => { @@ -285,7 +285,7 @@ describe('Svelte Plugin', () => { }) .onSecondCall() .returns({ - version: '2.8.0', + version: '3.1.0', resolveConfig: () => Promise.resolve(config), getFileInfo: () => ({ ignored: false }), format: formatStub, @@ -308,7 +308,7 @@ describe('Svelte Plugin', () => { .stub(importPackage, 'importPrettier') .onFirstCall() .returns({ - version: '3.0.0', + version: '2.8.0', resolveConfig: () => Promise.resolve(config), getFileInfo: () => ({ ignored: false }), format: () => { @@ -318,7 +318,7 @@ describe('Svelte Plugin', () => { }) .onSecondCall() .returns({ - version: '2.8.0', + version: '3.0.0', resolveConfig: () => Promise.resolve(config), getFileInfo: () => ({ ignored: false }), format: formatStub,