Skip to content

Commit 3f0decd

Browse files
committed
fix(language-core): trigger targets dirty when associatedOnly is true
1 parent 0d1fabb commit 3f0decd

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

packages/language-core/index.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,20 @@ export function createLanguage<T>(
6767
const sourceScript = scriptRegistry.get(id)!;
6868
if (sourceScript.languageId !== languageId || sourceScript.associatedOnly !== associatedOnly) {
6969
this.delete(id);
70+
triggerTargetsDirty(sourceScript);
7071
return this.set(id, snapshot, languageId);
7172
}
7273
else if (associatedOnly) {
73-
sourceScript.snapshot = snapshot;
74+
if (sourceScript.snapshot !== snapshot) {
75+
sourceScript.snapshot = snapshot;
76+
triggerTargetsDirty(sourceScript);
77+
}
7478
}
7579
else if (sourceScript.isAssociationDirty || sourceScript.snapshot !== snapshot) {
76-
// snapshot updated
77-
sourceScript.snapshot = snapshot;
80+
if (sourceScript.snapshot !== snapshot) {
81+
sourceScript.snapshot = snapshot;
82+
triggerTargetsDirty(sourceScript);
83+
}
7884
const codegenCtx = prepareCreateVirtualCode(sourceScript);
7985
if (sourceScript.generated) {
8086
const { updateVirtualCode, createVirtualCode } = sourceScript.generated.languagePlugin;
@@ -95,7 +101,6 @@ export function createLanguage<T>(
95101
return;
96102
}
97103
}
98-
triggerTargetsDirty(sourceScript);
99104
}
100105
else {
101106
// not changed

0 commit comments

Comments
 (0)