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.

632 B
Raw Blame
import type { LibraryGroup } from "@/bindings";

/** Merge shared SDKs and package groups without losing different module roots. */
export function mergeLibraryGroups(groups: readonly LibraryGroup[]): LibraryGroup[] {
  const merged: LibraryGroup[] = [];
  for (const group of groups) {
    const existing = merged.find((g) => g.kind === group.kind && g.name === group.name);
    if (!existing) {
      merged.push({ ...group, roots: [...group.roots] });
      continue;
    }
    for (const root of group.roots) {
      if (!existing.roots.some((r) => r.path === root.path)) existing.roots.push(root);
    }
  }
  return merged;
}