Skip to content

Commit

Permalink
Disable formatting (#364)
Browse files Browse the repository at this point in the history
Formatting embedded content causes too much unexpected behaviour in MDX
files.

Closes #355
  • Loading branch information
remcohaszing committed Dec 12, 2023
1 parent 7c00fc3 commit 423bf18
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 32 deletions.
7 changes: 7 additions & 0 deletions .changeset/tasty-geckos-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@mdx-js/language-service": patch
"@mdx-js/language-server": patch
"vscode-mdx": patch
---

Disable formatting
36 changes: 18 additions & 18 deletions packages/language-service/lib/language-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand All @@ -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
}
}

Expand All @@ -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
}
}

Expand Down Expand Up @@ -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
}
}
],
Expand Down Expand Up @@ -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
}
}
],
Expand All @@ -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
}
}
]
Expand Down
28 changes: 14 additions & 14 deletions packages/language-service/test/language-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -798,7 +798,7 @@ test('update virtual file', () => {
lengths: [19],
data: {
completion: true,
format: true,
format: false,
navigation: true,
semantic: true,
structure: true,
Expand Down

0 comments on commit 423bf18

Please sign in to comment.