Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

640 B
Raw Blame
import { create } from "zustand";

/** Snapshots of the host's bounded, read-only output channels. */
export const usePluginOutput = create<{ channels: Map<string, string> }>(() => ({ channels: new Map() }));
export const outputKey = (pluginId: string, channel: string) => JSON.stringify([pluginId, channel]);
export function setPluginOutput(pluginId: string, channel: string, text: string | null) {
  usePluginOutput.setState((s) => {
    const channels = new Map(s.channels);
    if (text === null) channels.delete(outputKey(pluginId, channel));
    else channels.set(outputKey(pluginId, channel), text);
    return { channels };
  });
}