fix(search): improve quick-open ranking and simplify settings

This commit is contained in:
zipg authored and GitHub committed 2026-08-12 00:08:42 +08:00
1 parent cb8d7ad014
commit bce120f870
16 files changed
+316 -86

No files matched your search

@@ -50,6 +50,16 @@ describe("shortcutRegistry editor actions", () => {
expect(findShortcutConflict("expandSelectStar", DEFAULT_SHORTCUT_SETTINGS.expandSelectStar, DEFAULT_SHORTCUT_SETTINGS)).toBeNull();
});
it("keeps current-view search and editor find contextual on Mod+F", () => {
const focusSearch = SHORTCUT_DEFINITIONS.find((item) => item.id === "focusSearch");
const find = SHORTCUT_DEFINITIONS.find((item) => item.id === "find");
expect(focusSearch).toMatchObject({ scope: "global", defaultShortcut: "Mod+F" });
expect(find).toMatchObject({ scope: "editor", defaultShortcut: "Mod+F" });
expect(findShortcutConflict("focusSearch", DEFAULT_SHORTCUT_SETTINGS.focusSearch, DEFAULT_SHORTCUT_SETTINGS)).toBeNull();
expect(findShortcutConflict("find", DEFAULT_SHORTCUT_SETTINGS.find, DEFAULT_SHORTCUT_SETTINGS)).toBeNull();
});
it("uses Shift+Enter for inserting a complete line below", () => {
const definition = SHORTCUT_DEFINITIONS.find((item) => item.id === "insertLineBelow");
@@ -32,6 +32,11 @@ function makeSettings(overrides: Partial<EditorSettings> = {}): EditorSettings {
}
describe("EDITOR_SETTINGS_DRAFT_KEYS", () => {
it("keeps connection and query timeout ownership outside editor settings", () => {
expect(EDITOR_SETTINGS_DRAFT_KEYS).not.toContain("globalConnectTimeoutSecs");
expect(EDITOR_SETTINGS_DRAFT_KEYS).not.toContain("globalQueryTimeoutSecs");
});
it("includes continueOnErrorOnBatch", () => {
expect(EDITOR_SETTINGS_DRAFT_KEYS).toContain("continueOnErrorOnBatch");
});
@@ -61,6 +66,16 @@ describe("EDITOR_SETTINGS_DRAFT_KEYS", () => {
});
describe("editorSettingsDraftFromSettings", () => {
it("does not include persisted global timeout values in editor drafts", () => {
const settings = makeSettings({ globalConnectTimeoutSecs: 17, globalQueryTimeoutSecs: 43 });
const draft = editorSettingsDraftFromSettings(settings);
expect(draft).not.toHaveProperty("globalConnectTimeoutSecs");
expect(draft).not.toHaveProperty("globalQueryTimeoutSecs");
expect(editorSettingsPatchFromDraft(draft, draft)).not.toHaveProperty("globalConnectTimeoutSecs");
expect(editorSettingsPatchFromDraft(draft, draft)).not.toHaveProperty("globalQueryTimeoutSecs");
});
it("maps continueOnErrorOnBatch from settings", () => {
const draft = editorSettingsDraftFromSettings(makeSettings({ continueOnErrorOnBatch: true }));
expect(draft.continueOnErrorOnBatch).toBe(true);
@@ -37,6 +37,11 @@ describe("settings search", () => {
{ id: "desktop", category: "about", titleKey: "hidden", visible: ({ isWeb }) => !isWeb },
];
it("does not index connection or query timeout under editor settings", () => {
expect(SETTINGS_SEARCH_DEFINITIONS.map((definition) => definition.id)).not.toContain("editor-global-connect-timeout");
expect(SETTINGS_SEARCH_DEFINITIONS.map((definition) => definition.id)).not.toContain("editor-global-query-timeout");
});
it("matches translated title, description, and category without changing declared order", () => {
const entries = resolveSettingsSearchEntries(definitions, { isWeb: false, visibleCategories: allCategories }, translate, categoryLabels);
expect(searchSettings(entries, "TYPEFACE", "en").map((entry) => entry.id)).toEqual(["font"]);
@@ -14,8 +14,6 @@ export const EDITOR_SETTINGS_DRAFT_KEYS = [
"activeCustomThemeId",
"executeMode",
"executeAllOnBlankLine",
"globalConnectTimeoutSecs",
"globalQueryTimeoutSecs",
"showExecutionTargetPicker",
"showStatementRunButtons",
"showCurrentStatementFrame",
@@ -107,8 +107,6 @@ export const SETTINGS_SEARCH_DEFINITIONS: readonly SettingsSearchDefinition[] =
{ id: "editor-font-size", category: "editor", titleKey: "settings.fontSize", targetId: "editor" },
{ id: "editor-execute-mode", category: "editor", titleKey: "settings.executeMode", targetId: "editor" },
{ id: "editor-execute-all-on-blank-line", category: "editor", titleKey: "settings.executeAllOnBlankLine", descriptionKey: "settings.executeAllOnBlankLineDescription", targetId: "editor" },
{ id: "editor-global-connect-timeout", category: "editor", titleKey: "settings.globalConnectTimeout", descriptionKey: "settings.globalConnectTimeoutDescription", targetId: "editor" },
{ id: "editor-global-query-timeout", category: "editor", titleKey: "settings.globalQueryTimeout", descriptionKey: "settings.globalQueryTimeoutDescription", targetId: "editor" },
{ id: "editor-execution-target", category: "editor", titleKey: "settings.showExecutionTargetPicker", descriptionKey: "settings.showExecutionTargetPickerDescription", targetId: "editor" },
{ id: "editor-run-buttons", category: "editor", titleKey: "settings.showStatementRunButtons", descriptionKey: "settings.showStatementRunButtonsDescription", targetId: "editor" },
{ id: "editor-statement-frame", category: "editor", titleKey: "settings.showCurrentStatementFrame", descriptionKey: "settings.showCurrentStatementFrameDescription", targetId: "editor" },