Файли
openidea/src/platform/fileOps.ts
T
Deng Liuтаdengliu 8cd121ed62 feat(docker): Compose detection, banner, gutter run and Services grouping (#2429)
Only compose.yml / docker-compose.yml were recognised as Compose files, so custom-named or content-only Compose YAML had no Docker icon, no gutter run markers and no Compose support, and running a docker-compose configuration from the gutter added a duplicate top-level Docker Compose group in Services. Compose files are now detected by filename (*compose*.yml/yaml) and by a bounded content scan that excludes Kubernetes, OpenAPI, GitHub Actions, Helm values and mkdocs files; content-detected files show a banner to confirm or reject, and the choice is stored in project settings and follows IDE renames. Detected files get the Docker icon in the tree and tabs, run markers on services: (whole stack) and on each service, and docker runs stay under the Docker node in Services.

Co-authored-by: dengliu <[email protected]>
2026-11-10 09:20:33 +08:00

48 рядки
1.3 KiB
TypeScript
Неформатований Анотація Історія

Цей файл містить неоднозначні символи Юнікоду
Цей файл містить символи Юнікоду, які можна сплутати з іншими символами. Якщо ви вважаєте, що це зроблено навмисно, можете сміливо ігнорувати це попередження. Щоб показати їх, скористайтеся кнопкою Escape.
/**
* Files created / deleted by an explicit IDE action (New File, Copy, Delete,
* file templates), as opposed to changes seen by the file watcher. VCS uses
* this for Settings › Version Control › Confirmation.
*/
import type { FileMove } from "./ipc";
export interface FileOperation {
kind: "created" | "deleted";
paths: string[];
}
type Listener = (op: FileOperation) => void;
const listeners = new Set<Listener>();
export function notifyFileOperation(op: FileOperation) {
for (const l of listeners) {
try {
l(op);
} catch (e) {
console.warn("file operation listener failed", e);
}
}
}
export function onFileOperation(listener: Listener): () => void {
listeners.add(listener);
return () => listeners.delete(listener);
}
const moveListeners = new Set<(moves: readonly FileMove[]) => void | Promise<void>>();
/** Explicit moves (including Undo), before editors reopen at their new paths. */
export async function notifyFilesMoved(moves: readonly FileMove[]): Promise<void> {
for (const listener of moveListeners) {
try {
await listener(moves);
} catch (e) {
console.warn("file move listener failed", e);
}
}
}
export function onFilesMoved(listener: (moves: readonly FileMove[]) => void | Promise<void>): () => void {
moveListeners.add(listener);
return () => moveListeners.delete(listener);
}