дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 01:31:41 +02:00
Broadcasts called their listeners in a bare loop, so one throwing handler kept the rest (including the catch-all "*" IDE event handlers) from seeing the event. The IDE event bus, local diagnostics, endpoint-change and navigation-modifier broadcasts now go through `notifyEach`, which logs a throwing listener and moves on. `onIdeEvent` wraps each subscription so unsubscribing one of two identical handlers keeps the other. Co-authored-by: rohitdanda <[email protected]>
21 рядки
771 B
TypeScript
21 рядки
771 B
TypeScript
/**
|
|
* Diagnostics computed in the UI (Typo, file references, SQL inspections), as
|
|
* full per-(file, producer) replacements like the backend's `diagnostics`
|
|
* event, so the Problems view sees them as well as the editor.
|
|
*/
|
|
import type { Diagnostic } from "@/bindings";
|
|
import { notifyEach } from "./listeners";
|
|
|
|
type Listener = (path: string, producer: string, items: readonly Diagnostic[]) => void;
|
|
|
|
const listeners = new Set<Listener>();
|
|
|
|
export function publishLocalDiagnostics(path: string, producer: string, items: readonly Diagnostic[]) {
|
|
notifyEach(listeners, (l) => l(path, producer, items), "local diagnostics");
|
|
}
|
|
|
|
export function onLocalDiagnostics(listener: Listener): () => void {
|
|
listeners.add(listener);
|
|
return () => listeners.delete(listener);
|
|
}
|