Файли
openidea/src/features/settings/languages/PathInput.tsx
T
l0ng-ai 5f782e9c5d feat(debugger): choose the GDB and lldb-dap executables for C/C++ debugging (#7205)
Settings › Build, Execution, Deployment › Debugger › C/C++ gets GDB executable and LLDB DAP executable (empty: find them on PATH as before; relative paths resolve against the project), as CLion lets a toolchain use a custom GDB. The GDB version check reads the chosen binary and names it when it is older than 14.

Fixes #7174
2026-12-01 17:33:45 +08:00

58 рядки
1.5 KiB
TypeScript

import { useId } from "react";
import { choosePath } from "@/platform/choosePath";
import { useTx } from "@/platform/i18n";
import { IconButton, Input } from "@/ui";
import { Row } from "../components/Form";
import { useSetting } from "../components/context";
import styles from "./Sdk.module.css";
interface PathFieldProps {
k: string;
placeholder: string;
title: string;
id?: string;
"aria-label"?: string;
/** Browse for a file instead of a directory. */
file?: boolean;
}
export function PathField({ k, placeholder, title, id, file, ...aria }: PathFieldProps) {
const [value, set] = useSetting<string>(k);
const tx = useTx();
return (
<span className={styles.pathRow}>
<Input
id={id}
mono
className={styles.pathInput}
value={value}
placeholder={placeholder}
onChange={(e) => set(e.target.value.trim())}
aria-label={aria["aria-label"]}
/>
<IconButton
icon="folder-open"
size="small"
title="Browse…"
onClick={async () => {
const p = await choosePath({ directory: !file, title: tx(title), defaultPath: value || undefined });
if (p) set(p);
}}
/>
</span>
);
}
export function PathInput({
label,
hint,
...field
}: Omit<PathFieldProps, "id" | "aria-label"> & { label: string; hint?: string }) {
const id = useId();
return (
<Row label={label} htmlFor={id} hint={hint}>
<PathField {...field} id={id} />
</Row>
);
}