From 423bf184d88789b7f2a519f7a48d981f38756b0f Mon Sep 17 00:00:00 2001 From: Remco Haszing Date: Tue, 12 Dec 2023 13:06:43 +0100 Subject: [PATCH] Disable formatting (#364) Formatting embedded content causes too much unexpected behaviour in MDX files. Closes #355 --- .changeset/tasty-geckos-obey.md | 7 ++++ .../language-service/lib/language-module.js | 36 +++++++++---------- .../language-service/test/language-module.js | 28 +++++++-------- 3 files changed, 39 insertions(+), 32 deletions(-) create mode 100644 .changeset/tasty-geckos-obey.md diff --git a/.changeset/tasty-geckos-obey.md b/.changeset/tasty-geckos-obey.md new file mode 100644 index 00000000..417f4cad --- /dev/null +++ b/.changeset/tasty-geckos-obey.md @@ -0,0 +1,7 @@ +--- +"@mdx-js/language-service": patch +"@mdx-js/language-server": patch +"vscode-mdx": patch +--- + +Disable formatting diff --git a/packages/language-service/lib/language-module.js b/packages/language-service/lib/language-module.js index d2d11bcf..a6b2d39d 100644 --- a/packages/language-service/lib/language-module.js +++ b/packages/language-service/lib/language-module.js @@ -115,12 +115,12 @@ function getVirtualFiles(fileName, snapshot, ts, processor) { generatedOffsets: [], lengths: [], data: { - verification: true, completion: true, - semantic: true, + format: false, navigation: true, + semantic: true, structure: true, - format: true + verification: true } } @@ -134,12 +134,12 @@ function getVirtualFiles(fileName, snapshot, ts, processor) { generatedOffsets: [], lengths: [], data: { - verification: true, completion: true, - semantic: true, + format: false, navigation: true, + semantic: true, structure: true, - format: true + verification: true } } @@ -153,12 +153,12 @@ function getVirtualFiles(fileName, snapshot, ts, processor) { generatedOffsets: [], lengths: [], data: { - verification: true, completion: true, - semantic: true, + format: false, navigation: true, + semantic: true, structure: true, - format: true + verification: true } } @@ -233,12 +233,12 @@ function getVirtualFiles(fileName, snapshot, ts, processor) { generatedOffsets: [0], lengths: [node.value.length], data: { - verification: true, completion: true, - semantic: true, + format: true, navigation: true, + semantic: true, structure: true, - format: true + verification: true } } ], @@ -410,12 +410,12 @@ export function getLanguageModule(ts, plugins) { generatedOffsets: [0], lengths: [length], data: { - verification: true, completion: true, - semantic: true, + format: true, navigation: true, + semantic: true, structure: true, - format: true + verification: true } } ], @@ -433,12 +433,12 @@ export function getLanguageModule(ts, plugins) { generatedOffsets: [0], lengths: [length], data: { - verification: true, completion: true, - semantic: true, + format: true, navigation: true, + semantic: true, structure: true, - format: true + verification: true } } ] diff --git a/packages/language-service/test/language-module.js b/packages/language-service/test/language-module.js index cd712267..437c3a75 100644 --- a/packages/language-service/test/language-module.js +++ b/packages/language-service/test/language-module.js @@ -49,7 +49,7 @@ test('create virtual file w/ mdxjsEsm', () => { lengths: [34], data: { completion: true, - format: true, + format: false, navigation: true, semantic: true, structure: true, @@ -86,7 +86,7 @@ test('create virtual file w/ mdxjsEsm', () => { lengths: [1], data: { completion: true, - format: true, + format: false, navigation: true, semantic: true, structure: true, @@ -141,7 +141,7 @@ test('create virtual file w/ mdxFlowExpression', () => { lengths: [9], data: { completion: true, - format: true, + format: false, navigation: true, semantic: true, structure: true, @@ -177,7 +177,7 @@ test('create virtual file w/ mdxFlowExpression', () => { lengths: [1], data: { completion: true, - format: true, + format: false, navigation: true, semantic: true, structure: true, @@ -239,7 +239,7 @@ test('create virtual file w/ mdxJsxFlowElement w/ children', () => { lengths: [9, 8], data: { completion: true, - format: true, + format: false, navigation: true, semantic: true, structure: true, @@ -279,7 +279,7 @@ test('create virtual file w/ mdxJsxFlowElement w/ children', () => { lengths: [48, 1], data: { completion: true, - format: true, + format: false, navigation: true, semantic: true, structure: true, @@ -334,7 +334,7 @@ test('create virtual file w/ mdxJsxFlowElement w/o children', () => { lengths: [7], data: { completion: true, - format: true, + format: false, navigation: true, semantic: true, structure: true, @@ -373,7 +373,7 @@ test('create virtual file w/ mdxJsxFlowElement w/o children', () => { lengths: [1], data: { completion: true, - format: true, + format: false, navigation: true, semantic: true, structure: true, @@ -428,7 +428,7 @@ test('create virtual file w/ mdxJsxTextElement', () => { lengths: [7], data: { completion: true, - format: true, + format: false, navigation: true, semantic: true, structure: true, @@ -464,7 +464,7 @@ test('create virtual file w/ mdxJsxTextElement', () => { lengths: [2, 1], data: { completion: true, - format: true, + format: false, navigation: true, semantic: true, structure: true, @@ -519,7 +519,7 @@ test('create virtual file w/ mdxTextExpression', () => { lengths: [9], data: { completion: true, - format: true, + format: false, navigation: true, semantic: true, structure: true, @@ -555,7 +555,7 @@ test('create virtual file w/ mdxTextExpression', () => { lengths: [4, 5], data: { completion: true, - format: true, + format: false, navigation: true, semantic: true, structure: true, @@ -695,7 +695,7 @@ test('create virtual file w/ yaml frontmatter', () => { lengths: [27], data: { completion: true, - format: true, + format: false, navigation: true, semantic: true, structure: true, @@ -798,7 +798,7 @@ test('update virtual file', () => { lengths: [19], data: { completion: true, - format: true, + format: false, navigation: true, semantic: true, structure: true,