fix(editor): keep SQL table names highlighted
This commit is contained in:
3 files changed
+21
-4
No files matched your search
+7
@@ -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');
|
||||
|
||||
@@ -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`,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user