Файли
openidea/src/features/settings/pages/spec.ts
T
l0ng-ai 059f25f13e feat(java): Separate the jdtls JDK and add Settings for New Projects (#21)
- Languages & Frameworks › Java › Language Server › JDK (languages.java.jdtlsJdk) runs jdtls on its own JDK, like IDEA's JDK for importer; the project keeps compiling and running with the Project JDK.
- Toolchain pages get the Global / This project switch (default This project); Global shows and edits the global layer.
- File › New Projects Setup › Settings for New Projects… edits only the global layer, which new projects inherit.
- Configuration errors (launch_error) show as "Not started" instead of "Crashed".

Fixes #18
Fixes #19

Claude-Session: https://claude.ai/code/session_01SaPPsVPuk6ZTNsoUCNCbMv
2026-10-24 18:26:31 +08:00

64 рядки
2.1 KiB
TypeScript

/**
* Declarative description of the built-in pages. Option labels double as the
* search index, so a page is found by any of its option names without having
* to render it.
*/
import type { ComponentType, ReactNode } from "react";
import type { SelectOption } from "@/ui";
export type OptionSpec =
| { kind: "toggle"; key: string; label: string; hint?: ReactNode }
| {
kind: "number";
key: string;
label: string;
min: number;
max: number;
step?: number;
integer?: boolean;
unit?: string;
hint?: ReactNode;
}
| { kind: "select"; key: string; label: string; options: readonly SelectOption[]; hint?: ReactNode }
| { kind: "text"; key: string; label: string; placeholder?: string; hint?: ReactNode }
/** Custom control; `label` is still indexed for search. */
| { kind: "custom"; label: string; keywords?: string[]; component: ComponentType };
export interface SectionSpec {
title?: string;
options: OptionSpec[];
}
export interface PageSpec {
id: string;
title: string;
group?: string;
order: number;
keywords?: string[];
/** Offers the Global / This project scope switch. */
projectScope?: boolean;
/** Scope shown first with a project open (toolchains belong to the project, like IDEA's project SDK). */
defaultScope?: "global" | "project";
sections?: SectionSpec[];
/** Rendered below the sections (previews). */
footer?: ComponentType;
/** Fully custom page (Keymap). */
component?: ComponentType;
/** Extra search texts computed at search time (e.g. action names). */
dynamicLabels?: () => string[];
}
/** Search texts of a spec: section titles, option labels and keywords. */
export function specLabels(spec: PageSpec): string[] {
const out: string[] = [...(spec.keywords ?? [])];
for (const section of spec.sections ?? []) {
if (section.title) out.push(section.title);
for (const o of section.options) {
out.push(o.label);
if (o.kind === "custom") out.push(...(o.keywords ?? []));
if (o.kind === "select") out.push(...o.options.map((x) => x.label));
}
}
return out;
}