27 files changed
+339
-15
No files matched your search
@@ -136,6 +136,10 @@ describe("EDITOR_SETTINGS_DRAFT_KEYS", () => {
|
||||
expect(EDITOR_SETTINGS_DRAFT_KEYS).toContain("completionTriggerMode");
|
||||
});
|
||||
|
||||
it("includes tableCompletionSchemaQualification", () => {
|
||||
expect(EDITOR_SETTINGS_DRAFT_KEYS).toContain("tableCompletionSchemaQualification");
|
||||
});
|
||||
|
||||
it("includes tableHoverLookupMode", () => {
|
||||
expect(EDITOR_SETTINGS_DRAFT_KEYS).toContain("tableHoverLookupMode");
|
||||
});
|
||||
@@ -231,6 +235,11 @@ describe("editorSettingsDraftFromSettings", () => {
|
||||
const draft = editorSettingsDraftFromSettings(makeSettings({ completionTriggerMode: "always" as unknown } as Partial<EditorSettings>));
|
||||
expect(draft.completionTriggerMode).toBe("positional");
|
||||
});
|
||||
|
||||
it("maps and normalizes tableCompletionSchemaQualification", () => {
|
||||
expect(editorSettingsDraftFromSettings(makeSettings({ tableCompletionSchemaQualification: "always" })).tableCompletionSchemaQualification).toBe("always");
|
||||
expect(editorSettingsDraftFromSettings(makeSettings({ tableCompletionSchemaQualification: "invalid" } as any)).tableCompletionSchemaQualification).toBe("collision");
|
||||
});
|
||||
});
|
||||
|
||||
describe("normalizeTableOpenPageSizeDraft", () => {
|
||||
@@ -406,6 +415,16 @@ describe("editorSettingsPatchFromDraft", () => {
|
||||
const patch = editorSettingsPatchFromDraft(draft, base);
|
||||
expect(patch.completionTriggerMode).toBeUndefined();
|
||||
});
|
||||
|
||||
it("includes tableCompletionSchemaQualification only when changed", () => {
|
||||
const settings = makeSettings({ tableCompletionSchemaQualification: "collision" });
|
||||
const draft = editorSettingsDraftFromSettings(settings);
|
||||
const base = editorSettingsDraftFromSettings(settings);
|
||||
|
||||
expect(editorSettingsPatchFromDraft(draft, base).tableCompletionSchemaQualification).toBeUndefined();
|
||||
draft.tableCompletionSchemaQualification = "never";
|
||||
expect(editorSettingsPatchFromDraft(draft, base).tableCompletionSchemaQualification).toBe("never");
|
||||
});
|
||||
});
|
||||
|
||||
describe("EDITOR_SETTINGS_DRAFT_KEYS - tabLayout", () => {
|
||||
|
||||
@@ -295,6 +295,7 @@ describe("settings search", () => {
|
||||
{ titleKey: "settings.sidebarObjectInfoMode", category: "navigation", targetId: "navigation" },
|
||||
{ titleKey: "settings.insertSpaceAfterCompletion", category: "editor", targetId: "editor" },
|
||||
{ titleKey: "settings.completionTriggerMode", category: "editor", targetId: "editor" },
|
||||
{ titleKey: "settings.tableCompletionSchemaQualification", category: "editor", targetId: "editor" },
|
||||
{ titleKey: "settings.autoAliasTables", category: "editor", targetId: "editor" },
|
||||
{ titleKey: "settings.clickTableNavigationTarget", category: "navigation", targetId: "navigation" },
|
||||
{ titleKey: "settings.prefillNewQueryWithSelect", category: "navigation", targetId: "navigation" },
|
||||
|
||||
@@ -68,6 +68,18 @@ describe("settingsTransfer", () => {
|
||||
expect(result.error.detail).toContain("updateDownloadSource");
|
||||
});
|
||||
|
||||
it("round-trips table completion schema qualification as an editor setting", () => {
|
||||
const result = parseSettingsTransferFile(fileWith({ tableCompletionSchemaQualification: "always" }));
|
||||
expect(result.ok).toBe(true);
|
||||
if (!result.ok) return;
|
||||
expect(result.value.editorSettings.tableCompletionSchemaQualification).toBe("always");
|
||||
expect(result.value.categories).toEqual(["editor"]);
|
||||
|
||||
const invalid = parseSettingsTransferFile(fileWith({ tableCompletionSchemaQualification: "sometimes" }));
|
||||
expect(invalid.ok).toBe(false);
|
||||
if (!invalid.ok) expect(invalid.error.detail).toContain("tableCompletionSchemaQualification");
|
||||
});
|
||||
|
||||
it("rejects out-of-range numbers that the normalizer clamps", () => {
|
||||
const result = parseSettingsTransferFile(fileWith({ sidebarIndent: 99999 }));
|
||||
expect(result.ok).toBe(false);
|
||||
|
||||
@@ -4,6 +4,7 @@ import { normalizeResultPageSize } from "@/lib/dataGrid/paginationPageSize";
|
||||
import { normalizeQueryResultMaxRows } from "@/lib/dataGrid/queryResultRowLimit";
|
||||
import { normalizeExternalSqlEditorMaxMb } from "@/lib/sql/sqlFileOpen";
|
||||
import { normalizeCompletionTriggerMode } from "@/lib/sql/sqlCompletionTriggerPolicy";
|
||||
import { normalizeSqlTableCompletionSchemaQualification } from "@/lib/sql/sqlCompletionSchemaQualification";
|
||||
import { normalizeTableHoverLookupMode } from "@/lib/editor/hoverTableLookup";
|
||||
import { normalizeRedisKeyTemplates } from "@/lib/redis/redisKeyTemplates";
|
||||
|
||||
@@ -25,6 +26,7 @@ export const EDITOR_SETTINGS_DRAFT_KEYS = [
|
||||
"showCurrentStatementFrame",
|
||||
"showInsertValueHints",
|
||||
"autoAliasTables",
|
||||
"tableCompletionSchemaQualification",
|
||||
"insertSpaceAfterCompletion",
|
||||
"sqlServerSpaceConfirmsCompletion",
|
||||
"sortCompletionColumnsAlphabetically",
|
||||
@@ -158,6 +160,7 @@ function normalizedDraftValue(key: EditorSettingsDraftKey, value: unknown): unkn
|
||||
if (key === "queryResultMaxRows") return normalizeQueryResultMaxRowsDraft(value);
|
||||
if (key === "externalSqlEditorMaxMb") return normalizeExternalSqlEditorMaxMb(value);
|
||||
if (key === "completionTriggerMode") return normalizeCompletionTriggerMode(value);
|
||||
if (key === "tableCompletionSchemaQualification") return normalizeSqlTableCompletionSchemaQualification(value);
|
||||
if (key === "tableHoverLookupMode") return normalizeTableHoverLookupMode(value);
|
||||
if (key === "redisKeyTemplates") return normalizeRedisKeyTemplates(value);
|
||||
if (key === "backgroundImage") return normalizeBackgroundImageSettings(value);
|
||||
|
||||
@@ -145,6 +145,7 @@ export const SETTINGS_SEARCH_DEFINITIONS: readonly SettingsSearchDefinition[] =
|
||||
{ id: "editor-completion-spacing", category: "editor", titleKey: "settings.insertSpaceAfterCompletion", descriptionKey: "settings.insertSpaceAfterCompletionDescription", targetId: "editor" },
|
||||
{ id: "editor-sqlserver-space-completion", category: "editor", titleKey: "settings.sqlServerSpaceConfirmsCompletion", descriptionKey: "settings.sqlServerSpaceConfirmsCompletionDescription", targetId: "editor", visible: sqlServerSpaceCompletionVisible },
|
||||
{ id: "editor-completion-trigger-mode", category: "editor", titleKey: "settings.completionTriggerMode", descriptionKey: "settings.completionTriggerModeDescription", targetId: "editor" },
|
||||
{ id: "editor-table-completion-schema-qualification", category: "editor", titleKey: "settings.tableCompletionSchemaQualification", descriptionKey: "settings.tableCompletionSchemaQualificationDescription", targetId: "editor" },
|
||||
{ id: "editor-auto-alias", category: "editor", titleKey: "settings.autoAliasTables", descriptionKey: "settings.autoAliasTablesDescription", targetId: "editor" },
|
||||
{ id: "editor-unsaved-close", category: "editor", titleKey: "settings.confirmUnsavedSqlClose", descriptionKey: "settings.confirmUnsavedSqlCloseDescription", targetId: "editor" },
|
||||
{ id: "editor-app-close-unsaved-tabs", category: "editor", titleKey: "settings.appCloseUnsavedTabsMode", descriptionKey: "settings.appCloseUnsavedTabsModeDescription", targetId: "editor" },
|
||||
|
||||
@@ -83,6 +83,7 @@ const SETTINGS_TRANSFER_CATEGORY_KEYS: Record<SettingsTransferCategoryId, readon
|
||||
"showCurrentStatementFrame",
|
||||
"showInsertValueHints",
|
||||
"autoAliasTables",
|
||||
"tableCompletionSchemaQualification",
|
||||
"insertSpaceAfterCompletion",
|
||||
"sqlServerSpaceConfirmsCompletion",
|
||||
"sortCompletionColumnsAlphabetically",
|
||||
|
||||
Reference in new issue
Block a user