Skip to content

Commit

Permalink
fix: don't generate mappings for Svelte and Vue files (#871)
Browse files Browse the repository at this point in the history
* fix: don't generate mappings for Svelte and Vue files

* chore: changeset
  • Loading branch information
Princesseuh committed May 15, 2024
1 parent 64a46b8 commit a401068
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 45 deletions.
6 changes: 6 additions & 0 deletions .changeset/eleven-pears-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@astrojs/language-server": patch
"astro-vscode": patch
---

Fixes certain code actions corrupting Vue and Svelte files in specific situations
16 changes: 1 addition & 15 deletions packages/language-server/src/core/svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,7 @@ class SvelteVirtualCode implements VirtualCode {
}

private onSnapshotUpdated() {
this.mappings = [
{
sourceOffsets: [0],
generatedOffsets: [0],
lengths: [this.snapshot.getLength()],
data: {
verification: true,
completion: true,
semantic: true,
navigation: true,
structure: true,
format: true,
},
},
];
this.mappings = [];

this.embeddedCodes = [];
this.embeddedCodes.push(
Expand Down
16 changes: 1 addition & 15 deletions packages/language-server/src/core/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,7 @@ export function framework2tsx(
getLength: () => content.length,
getChangeRange: () => undefined,
},
mappings: [
{
sourceOffsets: [0],
generatedOffsets: [0],
lengths: [content.length],
data: {
verification: true,
completion: true,
semantic: true,
navigation: true,
structure: true,
format: true,
},
},
],
mappings: [],
embeddedCodes: [],
};
}
Expand Down
16 changes: 1 addition & 15 deletions packages/language-server/src/core/vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,7 @@ class VueVirtualCode implements VirtualCode {
}

private onSnapshotUpdated() {
this.mappings = [
{
sourceOffsets: [0],
generatedOffsets: [0],
lengths: [this.snapshot.getLength()],
data: {
verification: true,
completion: true,
semantic: true,
navigation: true,
structure: true,
format: true,
},
},
];
this.mappings = [];

this.embeddedCodes = [];
this.embeddedCodes.push(
Expand Down

0 comments on commit a401068

Please sign in to comment.