дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 17:21:13 +02:00
SQL consoles and files get a Database Output bottom tool window. It follows the active editor, keeps result tabs and errors scoped to each console, and has a client selector (file name with its data source) for looking at another run, plus a button to open that client in its editor. Run and Explain reveal the current client's results while keeping editor focus; background completions and late Explain responses leave the selected client in view. Switching clients or destinations never re-runs SQL. Settings > Tools > Database can send results to Services instead. Closes #6176 Co-authored-by: principalwater <[email protected]>
30 рядки
1.0 KiB
TypeScript
30 рядки
1.0 KiB
TypeScript
import { useProject } from "@/platform/project";
|
|
import { showServiceView, toolWindowService } from "@/workbench/contributions";
|
|
|
|
export const DB_OUTPUT_WINDOW = "databaseOutput";
|
|
export const RESULTS_VIEW = "dbResults";
|
|
|
|
export function outputDestination(settings: unknown = useProject.getState().settings): "databaseOutput" | "services" {
|
|
return (settings as { database?: { outputDestination?: unknown } } | null)?.database?.outputDestination === "services"
|
|
? "services"
|
|
: "databaseOutput";
|
|
}
|
|
|
|
const outputRevealListeners = new Set<(path: string) => void>();
|
|
|
|
export function onOutputReveal(listener: (path: string) => void) {
|
|
outputRevealListeners.add(listener);
|
|
return () => {
|
|
outputRevealListeners.delete(listener);
|
|
};
|
|
}
|
|
|
|
export function revealDatabaseResults(path?: string) {
|
|
if (outputDestination() === "services") {
|
|
showServiceView(RESULTS_VIEW, false);
|
|
} else {
|
|
if (path !== undefined) for (const listener of outputRevealListeners) listener(path);
|
|
toolWindowService().show(DB_OUTPUT_WINDOW, false);
|
|
}
|
|
}
|