fix(editor): keep table highlights while the parser catches up

This commit is contained in:
dienaso authored and GitHub committed 2026-09-13 19:45:21 +08:00
1 parent 7afa87e849
commit 45ed1047a8
2 files changed
+18 -1

No files matched your search

@@ -36,6 +36,14 @@ describe("QueryEditor semantic highlighting while scrolling", () => {
expect(queryEditorSource).toContain("if (shouldPrewarmFullDocument) this.prewarmedDoc = doc;");
});
it("keeps existing highlights while the parser catches up instead of wiping them", () => {
// An incomplete Lezer parse must not clear table-name decorations: the
// deferred refresh retries, so a freshly mounted editor (tab switch) also
// recovers even without a later viewport change.
expect(queryEditorSource).toContain("this.scheduleRefresh(currentView);");
expect(queryEditorSource).toContain("return this.decorations;");
});
it("keeps preview and diagnostics on the shared statement-range cache", () => {
expect(queryEditorSource).toContain("executableStatementRangeCache = executableStatementRangeCacheForDoc");
expect(queryEditorSource).toContain('props.databaseType === "sqlserver" ? undefined : executableStatementRangeCache?.ranges');