feat(search): add global file content search in QuickOpen
This commit is contained in:
1 parent
5278594ed2
commit
04c6e67bbd
31 files changed
+1509
-16
No files matched your search
@@ -427,6 +427,9 @@ export const inspectExternalSqlFile = forward("inspectExternalSqlFile");
|
||||
export const writeExternalSqlFile = forward("writeExternalSqlFile");
|
||||
export const saveExternalSqlFile = forward("saveExternalSqlFile");
|
||||
export const listSqlFilesInFolder = forward("listSqlFilesInFolder");
|
||||
export const globalSearch = forward("globalSearch");
|
||||
export const loadGlobalSearchSettings = forward("loadGlobalSearchSettings");
|
||||
export const saveGlobalSearchSettings = forward("saveGlobalSearchSettings");
|
||||
export const createSqlFileInFolder = forward("createSqlFileInFolder");
|
||||
export const renameSqlFileInFolder = forward("renameSqlFileInFolder");
|
||||
export const deleteSqlFileInFolder = forward("deleteSqlFileInFolder");
|
||||
@@ -1066,6 +1069,9 @@ export type {
|
||||
QueryResultExportRequest,
|
||||
AgentEvent,
|
||||
SqlFileEntry,
|
||||
GlobalSearchRequest,
|
||||
GlobalSearchMatch,
|
||||
GlobalSearchSettings,
|
||||
} from "@/lib/backend/tauri";
|
||||
|
||||
// MQTT
|
||||
|
||||
@@ -2543,6 +2543,47 @@ export async function deleteSqlFileInFolder(_rootPath: string, _filePath: string
|
||||
throw new Error("Managing SQL files in folders is only available in the desktop app");
|
||||
}
|
||||
|
||||
export interface GlobalSearchRequest {
|
||||
roots: string[];
|
||||
query: string;
|
||||
extensions?: string[];
|
||||
caseSensitive?: boolean;
|
||||
useRegex?: boolean;
|
||||
wholeWord?: boolean;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export interface GlobalSearchMatch {
|
||||
path: string;
|
||||
fileName: string;
|
||||
line: number;
|
||||
column: number;
|
||||
matchText: string;
|
||||
lineText: string;
|
||||
}
|
||||
|
||||
export async function globalSearch(_request: GlobalSearchRequest): Promise<GlobalSearchMatch[]> {
|
||||
throw new Error("Global content search is only available in the desktop app");
|
||||
}
|
||||
|
||||
export interface GlobalSearchSettings {
|
||||
roots: string[];
|
||||
extensions: string[];
|
||||
}
|
||||
|
||||
export async function loadGlobalSearchSettings(): Promise<GlobalSearchSettings | null> {
|
||||
try {
|
||||
const raw = globalThis.localStorage?.getItem("dbx-global-search-settings-disk");
|
||||
return raw ? (JSON.parse(raw) as GlobalSearchSettings) : null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export async function saveGlobalSearchSettings(settings: GlobalSearchSettings): Promise<void> {
|
||||
globalThis.localStorage?.setItem("dbx-global-search-settings-disk", JSON.stringify(settings));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Data Transfer
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -789,6 +789,19 @@ export async function saveEditorSettings(settings: unknown): Promise<void> {
|
||||
return invoke("save_editor_settings", { settings });
|
||||
}
|
||||
|
||||
export interface GlobalSearchSettings {
|
||||
roots: string[];
|
||||
extensions: string[];
|
||||
}
|
||||
|
||||
export function loadGlobalSearchSettings(): Promise<GlobalSearchSettings | null> {
|
||||
return invoke("load_global_search_settings");
|
||||
}
|
||||
|
||||
export function saveGlobalSearchSettings(settings: GlobalSearchSettings): Promise<void> {
|
||||
return invoke("save_global_search_settings", { settings });
|
||||
}
|
||||
|
||||
export interface BackgroundImageInfo {
|
||||
storedPath: string;
|
||||
fileName: string;
|
||||
@@ -1079,6 +1092,31 @@ export async function deleteSqlFileInFolder(rootPath: string, filePath: string):
|
||||
return invoke("delete_sql_file_in_folder", { rootPath, filePath });
|
||||
}
|
||||
|
||||
export interface GlobalSearchRequest {
|
||||
roots: string[];
|
||||
query: string;
|
||||
extensions?: string[];
|
||||
caseSensitive?: boolean;
|
||||
useRegex?: boolean;
|
||||
wholeWord?: boolean;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export interface GlobalSearchMatch {
|
||||
path: string;
|
||||
fileName: string;
|
||||
/** 1-based line number. */
|
||||
line: number;
|
||||
/** 1-based char column within the line (for CodeMirror). */
|
||||
column: number;
|
||||
matchText: string;
|
||||
lineText: string;
|
||||
}
|
||||
|
||||
export async function globalSearch(request: GlobalSearchRequest): Promise<GlobalSearchMatch[]> {
|
||||
return invoke("global_search", { request });
|
||||
}
|
||||
|
||||
// --- AI Conversations ---
|
||||
|
||||
export interface AiChatMessage {
|
||||
|
||||
Reference in new issue
Block a user