fix(editor): keep SQL table names highlighted

This commit is contained in:
zipg authored and GitHub committed 2026-09-13 01:59:21 +08:00
1 parent 579008ffbd
commit 6694e4382e
3 files changed
+21 -4

No files matched your search

@@ -29,6 +29,13 @@ describe("QueryEditor semantic highlighting while scrolling", () => {
expect(queryEditorSource).toContain("refreshSqlSemanticHighlightEffect.of(null)");
});
it("never exposes undefined decorations and prewarms the full document only once per document", () => {
expect(queryEditorSource).toContain("this.decorations = Decoration.none;");
expect(queryEditorSource).toContain('private prewarmedDoc: import("@codemirror/state").Text | null = null;');
expect(queryEditorSource).toContain("const shouldPrewarmFullDocument =");
expect(queryEditorSource).toContain("if (shouldPrewarmFullDocument) this.prewarmedDoc = doc;");
});
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');
+4 -1
View File
@@ -31,7 +31,10 @@ export function createRunStatementButtonDom(ariaLabel = "Execute statement"): HT
export function sqlSemanticHighlightTheme(EditorView: typeof import("@codemirror/view").EditorView): Extension {
return EditorView.theme({
".cm-sql-table-name, .cm-sql-table-name *": {
color: `var(${SQL_TABLE_COLOR_CSS_VAR}) !important`,
// Built-in CodeMirror themes do not define the editor-specific table color
// variable. Keep semantic table names visible there as well, while custom
// and IDE themes continue to use their configured table color.
color: `var(${SQL_TABLE_COLOR_CSS_VAR}, #b4530b) !important`,
},
});
}