дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 19:25:54 +02:00
* fix(run): use system python per OS and pytest templates, detect pixi envs Gutter/context pytest configs on Windows used `python3`, which is not a command there; fall back to `python` on Windows. Gutter-created pytest configs now also inherit "Edit configuration templates... > pytest" values via a template cache populated with the run configurations. Pixi environments (`.pixi/envs/<env>`) are detected as the project's Python: as run-configuration env (`PyEnv::Pixi`, tools via `pixi run` or the env's own executables), as the project interpreter for scripts/tests and the debugger, and as selectable SDKs, so the interpreter picked in the IDE feeds completion. Fixes l0ng-ai/openidea#1885 * fix(run): drop the pytest template's own target in gutter configs testConfigFor always appends the gutter file, so a target stored on the template would run twice (template target plus the file). The gutter file is the target. Also corrects pixi_env's doc comment to the implemented name order.
31 рядки
1.1 KiB
TypeScript
31 рядки
1.1 KiB
TypeScript
/**
|
||
* A synchronous cache of the "Edit configuration templates…" values, so the
|
||
* run-context producers (gutter icons, ⌃⇧R) — which build configurations
|
||
* synchronously — can apply them. `loadConfigs` refreshes it from disk; the
|
||
* Edit Configurations dialog writes through it on save.
|
||
*/
|
||
import { call, commands, isTauri, type RunConfig } from "@/platform/ipc";
|
||
|
||
const cache = new Map<string, RunConfig>();
|
||
|
||
/** The stored template of `kind` ("Edit configuration templates…" › kind), if any. */
|
||
export function runTemplate(kind: string): RunConfig | undefined {
|
||
return cache.get(kind);
|
||
}
|
||
|
||
/** Caches the stored templates (called with `runTemplates()`'s result). */
|
||
export function cacheRunTemplates(templates: readonly RunConfig[]): void {
|
||
cache.clear();
|
||
for (const t of templates) cache.set(t.kind, t);
|
||
}
|
||
|
||
/** Refreshes the cache from disk; a no-op off the desktop. */
|
||
export async function loadRunTemplates(): Promise<void> {
|
||
if (!isTauri()) return;
|
||
try {
|
||
cacheRunTemplates(await call(commands.runTemplates()));
|
||
} catch {
|
||
/* keep the previous cache */
|
||
}
|
||
}
|