дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-03 16:51:16 +02:00
fix(settings): align field edges across settings sections
Цей коміт міститься в:
1 джерело
2221afad01
коміт
4f697bf274
12 files changed
+319
-171
No files matched your search
@@ -44,6 +44,18 @@ test("Gradle keeps the local installation with Distribution and saves edits in p
|
||||
|
||||
await expect(distribution).toHaveText("Gradle wrapper");
|
||||
await expect(installation).toHaveCount(0);
|
||||
const fields = userHome.or(runUsing).or(distribution).or(jvm);
|
||||
for (const width of [1120, 800, 520]) {
|
||||
await page.setViewportSize({ width, height: 760 });
|
||||
const edges = await fields.evaluateAll((elements) =>
|
||||
elements.map((element) => {
|
||||
const { left, right } = element.getBoundingClientRect();
|
||||
return [Math.round(left), Math.round(right)];
|
||||
}),
|
||||
);
|
||||
expect(edges).toHaveLength(4);
|
||||
for (const edge of edges.slice(1)) expect(edge).toEqual(edges[0]);
|
||||
}
|
||||
await distribution.click();
|
||||
await page.getByRole("option", { name: "Local installation", exact: true }).click();
|
||||
const browse = installation.locator("..").getByRole("button", { name: /^Browse/ });
|
||||
|
||||
@@ -74,6 +74,47 @@ test("settings forms share control columns and keep font metrics on one row", as
|
||||
}
|
||||
});
|
||||
|
||||
test("toolchain, encoding and Subversion settings align field frames across sections", async ({ workbench: page }) => {
|
||||
await page.keyboard.press("Meta+,");
|
||||
const body = page.getByRole("dialog", { name: "Settings", exact: true }).locator("[class*='pageBody']");
|
||||
for (const [id, title, count] of [
|
||||
["languages.go", "Go", 2],
|
||||
["languages.java", "Java", 4],
|
||||
["languages.rust", "Rust", 4],
|
||||
["languages.node", "JavaScript Runtime", 4],
|
||||
["languages.php", "PHP", 4],
|
||||
["build.maven", "Maven", 8],
|
||||
["editor.fileEncodings", "File Encodings", 4],
|
||||
["vcs.svn", "Subversion", 2],
|
||||
] as const) {
|
||||
await selectPage(page, id);
|
||||
await expect(page.getByLabel("Breadcrumb").locator('[aria-current="page"]')).toHaveText(title);
|
||||
if (id === "vcs.svn") {
|
||||
await body.getByRole("checkbox", { name: "Use custom configuration directory" }).check();
|
||||
await expect(body.getByRole("textbox", { name: /Configuration directory/ })).toBeEnabled();
|
||||
}
|
||||
const fields = body
|
||||
.getByRole("button")
|
||||
.and(body.locator("[aria-haspopup='listbox']"))
|
||||
.or(body.getByRole("textbox"))
|
||||
.or(body.getByRole("combobox"))
|
||||
.and(body.locator(':not([aria-label="Thread count"])'));
|
||||
await expect(fields).toHaveCount(count);
|
||||
for (const width of [1200, 800, 520]) {
|
||||
await page.setViewportSize({ width, height: 800 });
|
||||
for (const group of [fields, body.getByRole("button", { name: "Browse…", exact: true })]) {
|
||||
const edges = await group.evaluateAll((elements) =>
|
||||
elements.map((element) => {
|
||||
const { left, right } = element.getBoundingClientRect();
|
||||
return [Math.round(left), Math.round(right)];
|
||||
}),
|
||||
);
|
||||
for (const edge of edges.slice(1)) expect(edge, `${id} at ${width}px`).toEqual(edges[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for (const locale of ["en", "zh"]) {
|
||||
test(`${locale} forms fit narrow settings panes without horizontal scrolling`, async ({ workbench: page }) => {
|
||||
await page.keyboard.press("Meta+,");
|
||||
|
||||
@@ -117,6 +117,29 @@ test("Live Templates gives the editor the full settings pane width and keeps var
|
||||
expect(await variables.evaluate((element) => element.scrollWidth - element.clientWidth)).toBe(0);
|
||||
});
|
||||
|
||||
test("Project settings aligns the visible fields and their browse buttons", async ({ workbench: page }) => {
|
||||
await page.keyboard.press("Meta+;");
|
||||
const dialog = page.getByRole("dialog", { name: "Project Structure", exact: true });
|
||||
const fields = dialog
|
||||
.getByRole("button", { name: /^(Project SDK|Project language level|Language server JDK)$/ })
|
||||
.or(dialog.getByRole("textbox", { name: "Compiler output" }));
|
||||
const browse = dialog.getByRole("button", { name: "Browse…" });
|
||||
await expect(fields).toHaveCount(4);
|
||||
await expect(browse).toHaveCount(3);
|
||||
for (const width of [1400, 800, 520]) {
|
||||
await page.setViewportSize({ width, height: 800 });
|
||||
for (const group of [fields, browse]) {
|
||||
const edges = await group.evaluateAll((elements) =>
|
||||
elements.map((element) => {
|
||||
const { left, right } = element.getBoundingClientRect();
|
||||
return [Math.round(left), Math.round(right)];
|
||||
}),
|
||||
);
|
||||
for (const edge of edges.slice(1)) expect(edge).toEqual(edges[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test("Project Structure keeps every details pane usable in a compact window", async ({ workbench: page }) => {
|
||||
await page.keyboard.press("Meta+;");
|
||||
const dialog = page.getByRole("dialog", { name: "Project Structure", exact: true });
|
||||
|
||||
@@ -38,9 +38,17 @@
|
||||
min-width: 0;
|
||||
}
|
||||
.formGroup > .row,
|
||||
.formGroup > .formGroup {
|
||||
.formGroup > .formGroup,
|
||||
.formGroup > .section,
|
||||
.formGroup > .section > .sectionBody {
|
||||
grid-template-columns: subgrid;
|
||||
}
|
||||
.formGroup > .section {
|
||||
display: grid;
|
||||
}
|
||||
.formGroup > .section > * {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
.formGroup > .stacked,
|
||||
.formGroup > .toggleRow {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
|
||||
@@ -10,7 +10,7 @@ import { useCallback, useEffect, useId, useMemo, useState } from "react";
|
||||
import { call, commands, type FlutterVersion, type Sdk } from "@/platform/ipc";
|
||||
import { IconButton, Input, type SelectOption, T } from "@/ui";
|
||||
import { JAVA_LANGUAGE_LEVELS, PHP_LANGUAGE_LEVELS } from "@/platform/languageSettings";
|
||||
import { GlobListEditor, Row, Section, Select, Toggle } from "../components/Form";
|
||||
import { FormGroup, GlobListEditor, Row, Section, Select, Toggle, type RowProps } from "../components/Form";
|
||||
import { choosePath } from "@/platform/choosePath";
|
||||
import { usePageContext, useSetting } from "../components/context";
|
||||
import { SdkField, tildify, useDetected, useJdtlsJdk } from "./components";
|
||||
@@ -19,6 +19,14 @@ import { mavenHomeProblem } from "./mavenHome";
|
||||
import { PathField, PathInput } from "./PathInput";
|
||||
import styles from "./Sdk.module.css";
|
||||
|
||||
function FieldRow({ children, ...row }: RowProps) {
|
||||
return (
|
||||
<Row {...row}>
|
||||
<span className={styles.alignedField}>{children}</span>
|
||||
</Row>
|
||||
);
|
||||
}
|
||||
|
||||
function SdkRow({
|
||||
k,
|
||||
label,
|
||||
@@ -47,9 +55,9 @@ function RunTargetRow({ language }: { language: "php" | "node" }) {
|
||||
if (target && target !== "local" && !targets.some((t) => t.id === target))
|
||||
options.push({ value: target, label: tx`Run in target ${target}` });
|
||||
return (
|
||||
<Row label="Run in target">
|
||||
<FieldRow label="Run in target">
|
||||
<Select value={target ?? ""} options={options} onChange={setTarget} aria-label="Run in target" />
|
||||
</Row>
|
||||
</FieldRow>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -80,19 +88,19 @@ export function NodePage() {
|
||||
[list],
|
||||
);
|
||||
return (
|
||||
<div className={styles.page}>
|
||||
<Section>
|
||||
<Row
|
||||
<FormGroup className={styles.toolchainSettings}>
|
||||
<Section stackFields>
|
||||
<FieldRow
|
||||
label="Preferred runtime"
|
||||
hint="Runs JavaScript and TypeScript files from the gutter and the editor's Run action."
|
||||
>
|
||||
<Select value={runtime} options={RUNTIME_OPTIONS} onChange={setRuntime} aria-label="Preferred runtime" />
|
||||
</Row>
|
||||
<Row label="Package manager" hint="Used by the npm run configurations detected from package.json scripts.">
|
||||
</FieldRow>
|
||||
<FieldRow label="Package manager" hint="Used by the npm run configurations detected from package.json scripts.">
|
||||
<Select value={pm} options={pmOptions} onChange={setPm} aria-label="Package manager" />
|
||||
</Row>
|
||||
</FieldRow>
|
||||
</Section>
|
||||
<Section title="Node.js">
|
||||
<Section title="Node.js" stackFields>
|
||||
<SdkRow
|
||||
k="languages.node.interpreter"
|
||||
label="Node interpreter"
|
||||
@@ -105,7 +113,7 @@ export function NodePage() {
|
||||
/>
|
||||
<RunTargetRow language="node" />
|
||||
</Section>
|
||||
</div>
|
||||
</FormGroup>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -162,14 +170,14 @@ export function PhpPage() {
|
||||
const selected = list.find((s) => s.path === (interpreter || pathPhp));
|
||||
const xdebug = useXdebug(selected);
|
||||
return (
|
||||
<div className={styles.page}>
|
||||
<Section>
|
||||
<Row
|
||||
<FormGroup className={styles.toolchainSettings}>
|
||||
<Section stackFields>
|
||||
<FieldRow
|
||||
label="PHP language level"
|
||||
hint="The PHP version Intelephense checks the code against: newer syntax and functions are reported. Auto uses config.platform.php from composer.json, else the lowest version require.php allows."
|
||||
>
|
||||
<Select value={level} options={PHP_LEVEL_OPTIONS} onChange={setLevel} aria-label="PHP language level" />
|
||||
</Row>
|
||||
</FieldRow>
|
||||
<Row
|
||||
label="Include paths"
|
||||
stacked
|
||||
@@ -200,7 +208,7 @@ export function PhpPage() {
|
||||
/>
|
||||
</Row>
|
||||
</Section>
|
||||
<Section title="PHPStan">
|
||||
<Section title="PHPStan" stackFields>
|
||||
<PathInput
|
||||
k="languages.php.phpstanConfig"
|
||||
label="Configuration file"
|
||||
@@ -210,7 +218,7 @@ export function PhpPage() {
|
||||
file
|
||||
/>
|
||||
</Section>
|
||||
<Section title="CLI Interpreter">
|
||||
<Section title="CLI Interpreter" stackFields>
|
||||
<RunTargetRow language="php" />
|
||||
<SdkRow
|
||||
k="languages.php.interpreter"
|
||||
@@ -225,7 +233,7 @@ export function PhpPage() {
|
||||
{selected?.version && <Row label="Version">{selected.version}</Row>}
|
||||
{xdebug !== undefined && <Row label="Xdebug">{xdebug ?? <T>Not installed</T>}</Row>}
|
||||
</Section>
|
||||
</div>
|
||||
</FormGroup>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -263,8 +271,8 @@ export function RustPage() {
|
||||
const selected = list.find((s) => s.path === toolchain);
|
||||
const argsId = useId();
|
||||
return (
|
||||
<div className={styles.page}>
|
||||
<Section title="Toolchain">
|
||||
<FormGroup className={styles.toolchainSettings}>
|
||||
<Section title="Toolchain" stackFields>
|
||||
<SdkRow
|
||||
k="languages.rust.toolchain"
|
||||
label="Toolchain location"
|
||||
@@ -284,8 +292,8 @@ export function RustPage() {
|
||||
hint="Sources of std for navigation and completion (RUST_SRC_PATH)."
|
||||
/>
|
||||
</Section>
|
||||
<Section title="External Linters">
|
||||
<Row label="External tool">
|
||||
<Section title="External Linters" stackFields>
|
||||
<FieldRow label="External tool">
|
||||
<Select
|
||||
value={checkCommand}
|
||||
options={[
|
||||
@@ -295,7 +303,7 @@ export function RustPage() {
|
||||
onChange={setCheckCommand}
|
||||
aria-label="External tool"
|
||||
/>
|
||||
</Row>
|
||||
</FieldRow>
|
||||
<Toggle
|
||||
label="Run external linter on save"
|
||||
checked={checkOnSave}
|
||||
@@ -303,8 +311,8 @@ export function RustPage() {
|
||||
hint="rust-analyzer runs the tool after each save and reports its diagnostics."
|
||||
/>
|
||||
</Section>
|
||||
<Section title="Rustfmt">
|
||||
<Row
|
||||
<Section title="Rustfmt" stackFields>
|
||||
<FieldRow
|
||||
label="Additional arguments"
|
||||
htmlFor={argsId}
|
||||
hint="Passed to rustfmt when reformatting, e.g. --edition 2024"
|
||||
@@ -316,9 +324,9 @@ export function RustPage() {
|
||||
value={rustfmtArgs}
|
||||
onChange={(e) => setRustfmtArgs(e.target.value)}
|
||||
/>
|
||||
</Row>
|
||||
</FieldRow>
|
||||
</Section>
|
||||
</div>
|
||||
</FormGroup>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -330,8 +338,8 @@ export function GoPage() {
|
||||
const { list } = useDetected("go");
|
||||
const defaultGopath = list.find((s) => s.extra)?.extra;
|
||||
return (
|
||||
<div className={styles.page}>
|
||||
<Section title="GOROOT">
|
||||
<FormGroup className={styles.toolchainSettings}>
|
||||
<Section title="GOROOT" stackFields>
|
||||
<SdkRow
|
||||
k="languages.go.goroot"
|
||||
label="GOROOT"
|
||||
@@ -344,7 +352,7 @@ export function GoPage() {
|
||||
hint="Go SDK used by gopls and the go run / test configurations."
|
||||
/>
|
||||
</Section>
|
||||
<Section title="GOPATH">
|
||||
<Section title="GOPATH" stackFields>
|
||||
<PathInput
|
||||
k="languages.go.gopath"
|
||||
label="Project GOPATH"
|
||||
@@ -352,7 +360,7 @@ export function GoPage() {
|
||||
title="Select GOPATH"
|
||||
/>
|
||||
</Section>
|
||||
<Section title="Formatting">
|
||||
<Section title="Formatting" stackFields>
|
||||
<Toggle
|
||||
label="Format with gofumpt"
|
||||
checked={gofumpt}
|
||||
@@ -360,7 +368,7 @@ export function GoPage() {
|
||||
hint="gopls applies gofumpt's stricter rules on top of gofmt when reformatting."
|
||||
/>
|
||||
</Section>
|
||||
</div>
|
||||
</FormGroup>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -385,8 +393,8 @@ export function JavaPage() {
|
||||
);
|
||||
const id = useId();
|
||||
return (
|
||||
<div className={styles.page}>
|
||||
<Section title="Project JDK">
|
||||
<FormGroup className={styles.toolchainSettings}>
|
||||
<Section title="Project JDK" stackFields>
|
||||
<SdkRow
|
||||
k="languages.java.jdk"
|
||||
label="SDK"
|
||||
@@ -398,7 +406,7 @@ export function JavaPage() {
|
||||
aria-label="Project JDK"
|
||||
hint="Compiles and runs the project: Run/Debug and JAVA_HOME for Maven and Gradle; it also runs jdtls when new enough for it."
|
||||
/>
|
||||
<Row
|
||||
<FieldRow
|
||||
label="Language level"
|
||||
hint="Java source and bytecode compliance level when no build descriptor overrides it."
|
||||
>
|
||||
@@ -408,9 +416,9 @@ export function JavaPage() {
|
||||
onChange={setLanguageLevel}
|
||||
aria-label="Java language level"
|
||||
/>
|
||||
</Row>
|
||||
</FieldRow>
|
||||
</Section>
|
||||
<Section title="Language Server">
|
||||
<Section title="Language Server" stackFields>
|
||||
<Toggle
|
||||
label="Share JDT LS across builds"
|
||||
checked={shared}
|
||||
@@ -434,7 +442,7 @@ export function JavaPage() {
|
||||
hint={jdtls.hint}
|
||||
minJava={jdtls.minJava}
|
||||
/>
|
||||
<Row
|
||||
<FieldRow
|
||||
label="JVM options"
|
||||
htmlFor={id}
|
||||
hint="Passed to the JVM running jdtls (java.jdt.ls.vmargs), e.g. -Xmx4g. jdtls runs with -XX:+UseG1GC -XX:G1PeriodicGCInterval=60000 -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=30 -Xmx2G -Xms100m by default; an option set here replaces the default for the same setting, and another collector (e.g. -XX:+UseZGC) replaces the default collector options. A Lombok agent is added automatically: the one installed in Language Servers, else, when the project uses Lombok (its build, an inherited parent POM or Gradle build, or its sources' imports), the newest from the Maven / Gradle caches."
|
||||
@@ -447,9 +455,9 @@ export function JavaPage() {
|
||||
placeholder="-Xmx4g"
|
||||
onChange={(e) => setVmArgs(e.target.value)}
|
||||
/>
|
||||
</Row>
|
||||
</FieldRow>
|
||||
</Section>
|
||||
</div>
|
||||
</FormGroup>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -461,8 +469,8 @@ export function GradlePage() {
|
||||
const [runUsing, setRunUsing] = useSetting<string>("languages.java.gradle.runUsing");
|
||||
const local = distribution === "local";
|
||||
return (
|
||||
<div className={styles.gradleSettings}>
|
||||
<Section>
|
||||
<FormGroup className={styles.toolchainSettings}>
|
||||
<Section stackFields>
|
||||
<PathInput
|
||||
k="languages.java.gradle.userHome"
|
||||
label="Gradle user home"
|
||||
@@ -471,8 +479,8 @@ export function GradlePage() {
|
||||
hint="Sets GRADLE_USER_HOME. Empty uses Gradle's default."
|
||||
/>
|
||||
</Section>
|
||||
<Section title="Build and Run">
|
||||
<Row
|
||||
<Section title="Build and Run" stackFields>
|
||||
<FieldRow
|
||||
label="Build and run using"
|
||||
hint="Gradle runs a main class as a JavaExec task on its source set's runtime classpath (Gradle's resource processing included). OpenIDEA launches it on the Java language server's classpath."
|
||||
>
|
||||
@@ -485,9 +493,9 @@ export function GradlePage() {
|
||||
{ value: "ide", label: "OpenIDEA" },
|
||||
]}
|
||||
/>
|
||||
</Row>
|
||||
</FieldRow>
|
||||
</Section>
|
||||
<Section title="Gradle runtime">
|
||||
<Section title="Gradle runtime" stackFields>
|
||||
<Row
|
||||
label="Distribution"
|
||||
hint={
|
||||
@@ -496,7 +504,7 @@ export function GradlePage() {
|
||||
: "Uses the Gradle wrapper when present, otherwise the project-pinned mise/asdf Gradle, then Gradle on PATH."
|
||||
}
|
||||
>
|
||||
<div className={styles.gradleDistribution}>
|
||||
<div className={local ? styles.localDistribution : styles.alignedField}>
|
||||
<Select
|
||||
value={distribution}
|
||||
onChange={setDistribution}
|
||||
@@ -527,7 +535,7 @@ export function GradlePage() {
|
||||
hint="JDK used for Gradle sync, tasks, run configurations and tests. An explicit JAVA_HOME in a run configuration takes precedence."
|
||||
/>
|
||||
</Section>
|
||||
</div>
|
||||
</FormGroup>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -544,8 +552,8 @@ export function MavenPage() {
|
||||
const [activeProfiles, setActiveProfiles] = useSetting<string>("languages.java.maven.activeProfiles");
|
||||
const id = useId();
|
||||
return (
|
||||
<div className={styles.mavenSettings}>
|
||||
<Section>
|
||||
<FormGroup className={styles.toolchainSettings}>
|
||||
<Section stackFields>
|
||||
<Toggle
|
||||
label="Always update snapshots"
|
||||
checked={updateSnapshots}
|
||||
@@ -617,7 +625,7 @@ export function MavenPage() {
|
||||
hint="Passed as -t; selects the JDKs Maven compiles with."
|
||||
/>
|
||||
</Section>
|
||||
<Section title="Importing">
|
||||
<Section title="Importing" stackFields>
|
||||
<Toggle
|
||||
label="Automatically download sources"
|
||||
checked={downloadSources}
|
||||
@@ -632,7 +640,7 @@ export function MavenPage() {
|
||||
onChange={setDelegateBuild}
|
||||
hint="Run and Debug build Maven modules with Maven (the project's javac) instead of the Java language server. Editor problems still come from the language server."
|
||||
/>
|
||||
<Row
|
||||
<FieldRow
|
||||
label="Run tests using"
|
||||
hint="OpenIDEA runs a JUnit 4 or JUnit 5 test from the gutter on the Java language server's test classpath, without starting Maven, with the POM's Surefire configuration (argLine, system properties, environment variables, working directory). Maven runs it through Surefire, with filtered test resources."
|
||||
>
|
||||
@@ -645,7 +653,7 @@ export function MavenPage() {
|
||||
{ value: "maven", label: "Maven" },
|
||||
]}
|
||||
/>
|
||||
</Row>
|
||||
</FieldRow>
|
||||
<SdkRow
|
||||
k="languages.java.maven.runnerJre"
|
||||
label="JRE"
|
||||
@@ -656,7 +664,7 @@ export function MavenPage() {
|
||||
aria-label="JRE"
|
||||
hint="JDK used for Maven sync, builds, goals and tests. An explicit JAVA_HOME in a run configuration takes precedence."
|
||||
/>
|
||||
<Row
|
||||
<FieldRow
|
||||
label="Active profiles"
|
||||
htmlFor={`${id}-profiles`}
|
||||
hint="Comma-separated profiles (-P), combined with Maven tool window choices; !id excludes a profile. A run configuration’s own -P replaces these profiles."
|
||||
@@ -670,9 +678,9 @@ export function MavenPage() {
|
||||
onChange={(e) => setActiveProfiles(e.target.value)}
|
||||
aria-label="Active profiles"
|
||||
/>
|
||||
</Row>
|
||||
</FieldRow>
|
||||
</Section>
|
||||
<Section>
|
||||
<Section stackFields>
|
||||
<Toggle
|
||||
label="Use Maven Daemon (mvnd)"
|
||||
checked={daemon}
|
||||
@@ -687,7 +695,7 @@ export function MavenPage() {
|
||||
hint="The mvnd home (or its executable). Empty = $MVND_HOME, else mvnd on PATH."
|
||||
/>
|
||||
</Section>
|
||||
</div>
|
||||
</FormGroup>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ import {
|
||||
type ProjectStructureValid,
|
||||
} from "@/platform/languageSettings";
|
||||
import { initProjectRoots, useDetectedRoots } from "@/platform/projectRoots";
|
||||
import { Row, SearchLabel, Section } from "../components/Form";
|
||||
import { FormGroup, Row, SearchLabel, Section } from "../components/Form";
|
||||
import { detectSdks, forgetSdk, rememberSdk, useSdks, type SdkKind } from "./api";
|
||||
import { choosePath } from "@/platform/choosePath";
|
||||
import { DownloadJdkDialog } from "./DownloadJdkDialog";
|
||||
@@ -340,8 +340,8 @@ function ProjectSection() {
|
||||
const outId = useId();
|
||||
|
||||
return (
|
||||
<div className={styles.page}>
|
||||
<Section title="Project">
|
||||
<FormGroup className={styles.projectSettings}>
|
||||
<Section title="Project" stackFields>
|
||||
<Row label="Project name" hint={root ?? "No project is currently open."}>
|
||||
<span className={styles.path}>{name || "Default Project"}</span>
|
||||
</Row>
|
||||
@@ -364,19 +364,21 @@ function ProjectSection() {
|
||||
label="Language level"
|
||||
hint="Default Java language level for source code assistance and compilation across project modules."
|
||||
>
|
||||
<Select
|
||||
value={languageLevel ?? ""}
|
||||
options={PROJECT_JAVA_LEVEL_OPTIONS}
|
||||
onChange={setLanguageLevel}
|
||||
aria-label="Project language level"
|
||||
/>
|
||||
<span className={styles.alignedField}>
|
||||
<Select
|
||||
value={languageLevel ?? ""}
|
||||
options={PROJECT_JAVA_LEVEL_OPTIONS}
|
||||
onChange={setLanguageLevel}
|
||||
aria-label="Project language level"
|
||||
/>
|
||||
</span>
|
||||
</Row>
|
||||
<Row
|
||||
label="Compiler output"
|
||||
htmlFor={outId}
|
||||
hint="Default directory where compiled classes are placed when not managed by Maven or Gradle."
|
||||
>
|
||||
<span className={styles.pathRow}>
|
||||
<span className={styles.alignedField}>
|
||||
<Input
|
||||
id={outId}
|
||||
mono
|
||||
@@ -386,6 +388,7 @@ function ProjectSection() {
|
||||
onChange={(e) => setCompilerOutput(e.target.value)}
|
||||
/>
|
||||
<IconButton
|
||||
className={styles.alignedBrowse}
|
||||
icon="folder-open"
|
||||
size="small"
|
||||
title="Browse…"
|
||||
@@ -401,7 +404,7 @@ function ProjectSection() {
|
||||
</span>
|
||||
</Row>
|
||||
</Section>
|
||||
<Section title="Language Server">
|
||||
<Section title="Language Server" stackFields>
|
||||
<Row label="JDK" hint={jdtls.hint}>
|
||||
<SdkField
|
||||
kind="jdk"
|
||||
@@ -416,7 +419,7 @@ function ProjectSection() {
|
||||
/>
|
||||
</Row>
|
||||
</Section>
|
||||
</div>
|
||||
</FormGroup>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,38 @@
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.projectSettings {
|
||||
container: settings-content / inline-size;
|
||||
row-gap: var(--space-2);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.toolchainSettings {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.projectSettings .sdkField,
|
||||
.toolchainSettings .sdkField,
|
||||
.toolchainSettings .pathRow,
|
||||
.localDistribution,
|
||||
.alignedField {
|
||||
display: grid;
|
||||
/* Reserve the refresh and browse columns even on rows with fewer actions. */
|
||||
grid-template-columns: minmax(0, 1fr) repeat(2, 20px);
|
||||
align-items: center;
|
||||
gap: var(--space-1);
|
||||
width: 100%;
|
||||
max-width: 560px;
|
||||
min-width: 0;
|
||||
}
|
||||
.alignedField > :first-child,
|
||||
.localDistribution > :first-child {
|
||||
max-width: none;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
.alignedBrowse,
|
||||
.toolchainSettings .pathRow > button {
|
||||
grid-column: 3;
|
||||
}
|
||||
/* Editable ComboBox (Maven home): a text field with the combo's arrow inside its frame. */
|
||||
.sdkEditable {
|
||||
display: inline-flex;
|
||||
@@ -59,10 +91,8 @@
|
||||
font-size: var(--fs-small);
|
||||
}
|
||||
|
||||
.mavenSettings .sdkField,
|
||||
.mavenSettings .sdkEditable {
|
||||
.toolchainSettings .sdkEditable {
|
||||
min-width: 0;
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.mavenThreads {
|
||||
@@ -328,28 +358,20 @@
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.gradleSettings .pathRow {
|
||||
max-width: 560px;
|
||||
.localDistribution {
|
||||
grid-template-columns: minmax(0, 180px) minmax(0, 1fr) repeat(2, 20px);
|
||||
}
|
||||
|
||||
.gradleSettings .sdkField {
|
||||
min-width: 0;
|
||||
.localDistribution > .pathRow {
|
||||
grid-column: 2 / -1;
|
||||
grid-template-columns: subgrid;
|
||||
}
|
||||
|
||||
.gradleDistribution {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
width: 560px;
|
||||
}
|
||||
|
||||
.gradleDistribution > :first-child {
|
||||
flex: 0 1 180px;
|
||||
}
|
||||
|
||||
.gradleDistribution > .pathRow {
|
||||
flex: 1 1 230px;
|
||||
@container settings-content (max-width: 600px) {
|
||||
.localDistribution {
|
||||
grid-template-columns: minmax(0, 1fr) repeat(2, 20px);
|
||||
}
|
||||
.localDistribution > .pathRow {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Project Structure */
|
||||
|
||||
@@ -52,3 +52,37 @@
|
||||
grid-column: 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Share the input, browse and Test columns across both Subversion paths. */
|
||||
section > :has(> .svnPath) {
|
||||
grid-template-columns: fit-content(45%) minmax(0, 1fr) 20px max-content;
|
||||
}
|
||||
|
||||
.svnPath > div {
|
||||
grid-column: 2 / -1;
|
||||
}
|
||||
|
||||
.svnPath > div:first-of-type {
|
||||
display: grid;
|
||||
grid-template-columns: subgrid;
|
||||
}
|
||||
|
||||
.svnPath input {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.svnConfig > label {
|
||||
padding-inline-start: var(--space-4);
|
||||
}
|
||||
|
||||
@container settings-content (max-width: 440px) {
|
||||
section > :has(> .svnPath) {
|
||||
grid-template-columns: minmax(0, 1fr) 20px max-content;
|
||||
}
|
||||
|
||||
.svnPath > label,
|
||||
.svnPath > div {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,11 @@
|
||||
max-width: 760px;
|
||||
}
|
||||
|
||||
.alignedFields button[aria-haspopup="listbox"] {
|
||||
width: min(320px, 100%);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.check {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -630,6 +630,7 @@ const ENCODINGS: SelectOption[] = ENCODING_CHOICES.map(([value, label]) => ({ va
|
||||
|
||||
const ENCODINGS_PAGE = editorPage({
|
||||
id: "editor.fileEncodings",
|
||||
alignFields: true,
|
||||
title: "File Encodings",
|
||||
order: 27,
|
||||
projectScope: true,
|
||||
|
||||
@@ -10,7 +10,7 @@ import clsx from "clsx";
|
||||
import { Checkbox, Input, T, type SelectOption } from "@/ui";
|
||||
import { executeAction } from "@/platform/actions";
|
||||
import { tx } from "@/platform/i18n";
|
||||
import { NumberInput, Row, SearchLabel, Section, Select } from "../../components/Form";
|
||||
import { FormGroup, NumberInput, Row, SearchLabel, Section, Select } from "../../components/Form";
|
||||
import { useLabelMatch, usePageContext, useSetting } from "../../components/context";
|
||||
import type { PageSpec } from "../spec";
|
||||
import styles from "./Editor.module.css";
|
||||
@@ -67,6 +67,7 @@ export interface EditorPageDef {
|
||||
keywords?: string[];
|
||||
projectScope?: boolean;
|
||||
sections: EditorSection[];
|
||||
alignFields?: boolean;
|
||||
/** Rendered below the sections (previews, tables). */
|
||||
footer?: ComponentType;
|
||||
}
|
||||
@@ -324,18 +325,15 @@ export function ItemView({ item }: { item: Item }) {
|
||||
}
|
||||
}
|
||||
|
||||
export function EditorSections({ sections }: { sections: EditorSection[] }) {
|
||||
return (
|
||||
<>
|
||||
{sections.map((s, i) => (
|
||||
<Section key={s.title ?? i} title={s.title}>
|
||||
{s.items.map((item, j) => (
|
||||
<ItemView key={itemKey(item, j)} item={item} />
|
||||
))}
|
||||
</Section>
|
||||
export function EditorSections({ sections, alignFields }: Pick<EditorPageDef, "sections" | "alignFields">) {
|
||||
const body = sections.map((s, i) => (
|
||||
<Section key={s.title ?? i} title={s.title} stackFields={alignFields}>
|
||||
{s.items.map((item, j) => (
|
||||
<ItemView key={itemKey(item, j)} item={item} />
|
||||
))}
|
||||
</>
|
||||
);
|
||||
</Section>
|
||||
));
|
||||
return alignFields ? <FormGroup className={styles.alignedFields}>{body}</FormGroup> : <>{body}</>;
|
||||
}
|
||||
|
||||
/** Search texts of an item tree (labels, option labels, custom keywords). */
|
||||
@@ -365,7 +363,7 @@ export function editorPage(def: EditorPageDef): PageSpec {
|
||||
const Footer = def.footer;
|
||||
const Page = () => (
|
||||
<div className={styles.page}>
|
||||
<EditorSections sections={def.sections} />
|
||||
<EditorSections sections={def.sections} alignFields={def.alignFields} />
|
||||
{Footer && <Footer />}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -385,47 +385,44 @@ function SvnExecutableRow() {
|
||||
}
|
||||
};
|
||||
return (
|
||||
<div className={gitStyles.executable}>
|
||||
<Row
|
||||
label="Path to Subversion executable"
|
||||
htmlFor={id}
|
||||
hint={
|
||||
result ? (
|
||||
<span className={clsx(gitStyles.testResult, result.ok ? styles.ok : styles.error)} role="status">
|
||||
{result.text}
|
||||
</span>
|
||||
) : undefined
|
||||
}
|
||||
>
|
||||
<div className={gitStyles.executableControls}>
|
||||
<Input
|
||||
id={id}
|
||||
mono
|
||||
value={path}
|
||||
placeholder={detected ? tx`Auto-detected: ${detected}` : "Auto-detected"}
|
||||
onChange={(e) => {
|
||||
setPath(e.target.value);
|
||||
setResult(null);
|
||||
}}
|
||||
/>
|
||||
<IconButton
|
||||
icon="folder-open"
|
||||
size="small"
|
||||
title="Browse…"
|
||||
onClick={async () => {
|
||||
const chosen = await choosePath({ directory: false, defaultPath: path || detected || undefined });
|
||||
if (chosen) {
|
||||
setPath(chosen);
|
||||
setResult(null);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Button disabled={testing || !isTauri()} onClick={() => void test()}>
|
||||
<T>Test</T>
|
||||
</Button>
|
||||
</div>
|
||||
</Row>
|
||||
</div>
|
||||
<Row
|
||||
className={gitStyles.svnPath}
|
||||
label="Path to Subversion executable"
|
||||
htmlFor={id}
|
||||
hint={
|
||||
result ? (
|
||||
<span className={clsx(gitStyles.testResult, result.ok ? styles.ok : styles.error)} role="status">
|
||||
{result.text}
|
||||
</span>
|
||||
) : undefined
|
||||
}
|
||||
>
|
||||
<Input
|
||||
id={id}
|
||||
mono
|
||||
value={path}
|
||||
placeholder={detected ? tx`Auto-detected: ${detected}` : "Auto-detected"}
|
||||
onChange={(e) => {
|
||||
setPath(e.target.value);
|
||||
setResult(null);
|
||||
}}
|
||||
/>
|
||||
<IconButton
|
||||
icon="folder-open"
|
||||
size="small"
|
||||
title="Browse…"
|
||||
onClick={async () => {
|
||||
const chosen = await choosePath({ directory: false, defaultPath: path || detected || undefined });
|
||||
if (chosen) {
|
||||
setPath(chosen);
|
||||
setResult(null);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Button disabled={testing || !isTauri()} onClick={() => void test()}>
|
||||
<T>Test</T>
|
||||
</Button>
|
||||
</Row>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -436,30 +433,26 @@ function SvnConfigDirRow() {
|
||||
return (
|
||||
<>
|
||||
<BoundToggle k="vcs.svn.useCustomConfigDir" label="Use custom configuration directory" />
|
||||
<Indented>
|
||||
<Row label="Configuration directory" htmlFor={id}>
|
||||
<div className={gitStyles.executableControls}>
|
||||
<Input
|
||||
id={id}
|
||||
mono
|
||||
disabled={!custom}
|
||||
value={dir}
|
||||
placeholder="~/.subversion"
|
||||
onChange={(e) => setDir(e.target.value)}
|
||||
/>
|
||||
<IconButton
|
||||
icon="folder-open"
|
||||
size="small"
|
||||
title="Browse…"
|
||||
disabled={!custom}
|
||||
onClick={async () => {
|
||||
const chosen = await choosePath({ directory: true, defaultPath: dir || undefined });
|
||||
if (chosen) setDir(chosen);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Row>
|
||||
</Indented>
|
||||
<Row label="Configuration directory" htmlFor={id} className={clsx(gitStyles.svnPath, gitStyles.svnConfig)}>
|
||||
<Input
|
||||
id={id}
|
||||
mono
|
||||
disabled={!custom}
|
||||
value={dir}
|
||||
placeholder="~/.subversion"
|
||||
onChange={(e) => setDir(e.target.value)}
|
||||
/>
|
||||
<IconButton
|
||||
icon="folder-open"
|
||||
size="small"
|
||||
title="Browse…"
|
||||
disabled={!custom}
|
||||
onClick={async () => {
|
||||
const chosen = await choosePath({ directory: true, defaultPath: dir || undefined });
|
||||
if (chosen) setDir(chosen);
|
||||
}}
|
||||
/>
|
||||
</Row>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Заблокувати користувача