Skip to content

Commit

Permalink
chore: don't update if snapshot no change
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Aug 16, 2022
1 parent 276492b commit 8b05426
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/vue-language-core/src/sourceFile.ts
Expand Up @@ -322,7 +322,7 @@ export function createSourceFile(
}
});

update(scriptSnapshot);
update(scriptSnapshot, true);

return {
fileName,
Expand Down Expand Up @@ -398,7 +398,11 @@ export function createSourceFile(
}
return range;
}
function update(newScriptSnapshot: ts.IScriptSnapshot) {
function update(newScriptSnapshot: ts.IScriptSnapshot, init = false) {

if (newScriptSnapshot === snapshot.value && !init) {
return;
}

const change = newScriptSnapshot.getChangeRange(snapshot.value);
snapshot.value = newScriptSnapshot;
Expand Down

0 comments on commit 8b05426

Please sign in to comment.