Skip to content

Commit

Permalink
fix(language-core): ensure snapshots are always cached after updates
Browse files Browse the repository at this point in the history
  • Loading branch information
KazariEX committed Dec 10, 2024
1 parent 3fb59af commit bec59ce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/language-core/lib/virtualFile/computedVueSfc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ export function computedVueSfc(
// incremental update
if (cache?.plugin.updateSFC) {
const change = snapshot.get().getChangeRange(cache.snapshot);
cache.snapshot = snapshot.get();
if (change) {
const newSfc = cache.plugin.updateSFC(cache.sfc, {
start: change.span.start,
end: change.span.start + change.span.length,
newText: snapshot.get().getText(change.span.start, change.span.start + change.newLength),
});
if (newSfc) {
cache.snapshot = snapshot.get();
// force dirty
cache.sfc = JSON.parse(JSON.stringify(newSfc));
return cache.sfc;
Expand Down

0 comments on commit bec59ce

Please sign in to comment.