Files
openidea/src/features/settings/pages/execution.tsx
T
l0ng-ai eda632866a feat(maven): Always update snapshots setting (#4484)
Settings › Build Tools › Maven gets Always update snapshots (off by default, Global or This project). On, Maven runs, builds, goals and sync get -U and jdtls imports with java.maven.updateSnapshots, so newer SNAPSHOT dependencies are picked up from remote repositories. A configuration's own -U/--update-snapshots is kept; turning the setting off removes the -U it added.
2026-11-19 18:20:15 +08:00

425 lines
12 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Build, Execution, Deployment pages: Gradle, Maven, Console, Debugger (+ Data Views,
* Stepping), Python Debugger and Run/Debug. Consumed by the run and debugger
* features (and `ide-run` for encoding / termination timeout).
*/
import { WORKFLOW_LIMITS } from "@/platform/workflowSettings";
import type { SelectOption } from "@/ui";
import { ColorSwatches, FormGroup, GlobListEditor, NumberInput, Row, Toggle } from "../components/Form";
import { useSetting } from "../components/context";
import { lazyPage } from "./lazyPage";
import type { PageSpec } from "./spec";
import { Indented, ToggleNumber } from "./workflowControls";
import styles from "./Workflow.module.css";
import { T } from "@/ui";
const CMakeProfiles = lazyPage("build.cmake", () => import("./cmake").then((m) => m.CMakeProfiles));
const GradlePage = lazyPage("build.gradle", () => import("../languages/LanguagePages").then((m) => m.GradlePage));
const MavenPage = lazyPage("build.maven", () => import("../languages/LanguagePages").then((m) => m.MavenPage));
export const BUILD_GROUP = "Build, Execution, Deployment";
const L = WORKFLOW_LIMITS;
export const CONSOLE_ENCODINGS: SelectOption[] = [
"UTF-8",
"UTF-16LE",
"UTF-16BE",
"ISO-8859-1",
"windows-1250",
"windows-1251",
"windows-1252",
"GBK",
"GB18030",
"Big5",
"Shift_JIS",
"EUC-JP",
"EUC-KR",
"KOI8-R",
].map((e) => ({ value: e, label: e }));
function BufferRow() {
return (
<ToggleNumber
toggleKey="console.overrideBuffer"
numberKey="console.bufferKb"
label="Override console cycle buffer size"
unit="KB"
hint="Older output is discarded"
{...L.bufferKb}
/>
);
}
function FoldPatterns() {
const [patterns, set] = useSetting<string[]>("console.foldPatterns");
return (
<Row
label="Fold console lines that contain"
stacked
hint="Runs of consecutive matching lines collapse into one expandable “<N internal lines>” row."
>
<GlobListEditor
value={patterns}
onChange={set}
placeholder="at org.example."
aria-label="Fold console lines that contain"
/>
</Row>
);
}
/** The five console log levels, in severity order. */
const LOG_LEVELS = [
{ level: "error", label: "Error" },
{ level: "warn", label: "Warning" },
{ level: "info", label: "Info" },
{ level: "debug", label: "Debug" },
{ level: "trace", label: "Trace" },
] as const;
/** The level colours as presets: any level can take another level's colour. */
const LOG_COLOR_PRESETS = [
{ value: "var(--ansi-red)", label: "Red" },
{ value: "var(--ansi-yellow)", label: "Yellow" },
{ value: "var(--ansi-green)", label: "Green" },
{ value: "var(--ansi-cyan)", label: "Cyan" },
{ value: "var(--ansi-magenta)", label: "Magenta" },
];
function LogLevelColors() {
const [enabled, setEnabled] = useSetting<boolean>("console.logColors.enabled");
return (
<>
<Toggle
label="Colour log lines by level"
checked={enabled}
onChange={setEnabled}
hint="ERROR, WARN, INFO, DEBUG and TRACE lines take the colour of their level; colours the program prints itself are kept."
/>
{enabled && (
<FormGroup indented>
{LOG_LEVELS.map(({ level, label }) => (
<LogLevelRow key={level} level={level} label={label} />
))}
</FormGroup>
)}
</>
);
}
function LogLevelRow({ level, label }: { level: (typeof LOG_LEVELS)[number]["level"]; label: string }) {
const [value, setValue] = useSetting<string>(`console.logColors.${level}`);
return (
<Row label={label}>
<ColorSwatches value={value} presets={LOG_COLOR_PRESETS} onChange={setValue} aria-label={label} />
</Row>
);
}
function TooltipDelayRow() {
const [enabled] = useSetting<boolean>("debugger.valueTooltip");
const [delay, setDelay] = useSetting<number>("debugger.valueTooltipDelay");
return (
<Indented>
<Row label="Value tooltip delay (ms)">
<NumberInput
value={delay}
onChange={setDelay}
{...L.tooltipDelay}
integer
step={100}
aria-label="Value tooltip delay (ms)"
/>
{!enabled && (
<span className={styles.note}>
<T>Value tooltips are off</T>
</span>
)}
</Row>
</Indented>
);
}
export const EXECUTION_PAGES: PageSpec[] = [
{
id: "build.cmake",
title: "CMake",
group: BUILD_GROUP,
order: 357,
projectScope: true,
defaultScope: "project",
keywords: [
"profile",
"generator",
"Ninja",
"Build type",
"CMake arguments",
"Build directory",
"Build arguments",
"Environment variables",
],
component: CMakeProfiles,
},
{
id: "build.gradle",
projectScope: true,
defaultScope: "project",
title: "Gradle",
group: BUILD_GROUP,
order: 358,
keywords: [
"Build and run using",
"delegate",
"JavaExec",
"Gradle JVM",
"JDK",
"JAVA_HOME",
"distribution",
"wrapper",
"gradlew",
"local installation",
"Gradle home",
"Gradle user home",
"GRADLE_USER_HOME",
"mise",
"asdf",
],
component: GradlePage,
},
{
id: "build.maven",
projectScope: true,
defaultScope: "project",
title: "Maven",
group: BUILD_GROUP,
// IntelliJ IDEA: Build Tools › Maven, before Console / Debugger.
order: 359,
keywords: [
"Delegate IDE build/run actions to Maven",
"javac",
"ECJ",
"JRE",
"runner",
"JDK",
"JAVA_HOME",
"maven home",
"mvn",
"mvnw",
"wrapper",
"settings.xml",
"user settings",
"local repository",
"m2",
"thread count",
"threads",
"-T",
"parallel",
"Always update snapshots",
"SNAPSHOT",
"-U",
],
component: MavenPage,
},
{
id: "build.console",
title: "Console",
group: BUILD_GROUP,
order: 360,
projectScope: true,
keywords: ["run output", "encoding", "fold", "buffer", "colour"],
sections: [
{
options: [
{ kind: "custom", label: "Override console cycle buffer size", keywords: ["KB"], component: BufferRow },
{ kind: "toggle", key: "console.softWrap", label: "Use soft wraps in console" },
{
kind: "select",
key: "console.encoding",
label: "Default encoding",
options: CONSOLE_ENCODINGS,
hint: "Encoding of the output of processes started from Run configurations.",
},
{
kind: "custom",
label: "Colour log lines by level",
keywords: ["rainbow", "severity", "log level", "ANSI"],
component: LogLevelColors,
},
],
},
{ options: [{ kind: "custom", label: "Fold console lines that contain", component: FoldPatterns }] },
],
},
{
id: "build.debugger",
title: "Debugger",
group: BUILD_GROUP,
order: 361,
projectScope: true,
keywords: ["debug", "breakpoint"],
sections: [
{
options: [
{ kind: "toggle", key: "debugger.showOnBreakpoint", label: "Show debug window on breakpoint hit" },
{ kind: "toggle", key: "debugger.focusAppOnBreakpoint", label: "Focus application on breakpoint" },
{ kind: "toggle", key: "debugger.hideOnTermination", label: "Hide debug window on process termination" },
],
},
{
title: "JavaScript",
options: [
{
kind: "toggle",
key: "debugger.debugServerPage",
label: "Debug a dev server's page in the browser",
hint: "Debugging a script that starts Vite, Next.js or another dev server also opens its page in Chrome or Edge with the debugger attached.",
},
],
},
{
title: "Flutter",
options: [
{
kind: "toggle",
key: "debugger.flutterHotReloadOnSave",
label: "Hot reload on save",
hint: "Saving a Dart file of a running Flutter debug session reloads the app, unless the file has errors.",
},
],
},
{
title: "Breakpoints",
options: [
{
kind: "toggle",
key: "debugger.breakpointsAnyFile",
label: "Allow placing breakpoints in any file",
hint: "Otherwise line breakpoints can only be set in files of languages that have a debugger.",
},
{
kind: "toggle",
key: "debugger.runToCursorInlay",
label: "Show inlay Run to Cursor popup",
},
],
},
],
},
{
id: "build.debugger.dataViews",
title: "Data Views",
order: 0,
projectScope: true,
keywords: ["variables", "inline", "tooltip"],
sections: [
{
options: [
{
kind: "toggle",
key: "debugger.inlineValues",
label: "Show values inline",
hint: "Values of local variables are shown after the lines that use them while suspended.",
},
{ kind: "toggle", key: "debugger.sortValues", label: "Sort values alphabetically" },
{
kind: "toggle",
key: "debugger.liveWatches",
label: "Evaluate watches while the program runs",
hint: "Where the debugger can do it without suspending (JavaScript). A watch with side effects runs again on each refresh.",
},
{
kind: "toggle",
key: "debugger.valueTooltip",
label: "Show value tooltip on mouse hover",
hint: "Hovering a variable while suspended evaluates it in the selected frame.",
},
{ kind: "toggle", key: "debugger.valueTooltipOnSelection", label: "Show value tooltip on code selection" },
{ kind: "custom", label: "Value tooltip delay (ms)", component: TooltipDelayRow },
],
},
],
},
{
id: "build.debugger.stepping",
title: "Stepping",
order: 1,
projectScope: true,
keywords: ["step into", "library", "just my code"],
sections: [
{
options: [
{
kind: "toggle",
key: "debugger.skipLibraryCode",
label: "Do not step into library scripts",
hint: "Python: only your code (justMyCode). JavaScript: skips node_modules and Node.js internals.",
},
],
},
],
},
{
id: "build.pythonDebugger",
title: "Python Debugger",
group: BUILD_GROUP,
order: 362,
projectScope: true,
keywords: ["debugpy", "python", "gevent", "subprocess"],
sections: [
{
options: [
{
kind: "toggle",
key: "debugger.python.attachSubprocess",
label: "Attach to subprocess automatically while debugging",
},
{
kind: "toggle",
key: "debugger.python.gevent",
label: "Gevent compatible",
hint: "Enable when debugging code that uses gevent monkey-patching.",
},
],
},
],
},
{
id: "build.run",
title: "Run/Debug",
group: BUILD_GROUP,
order: 363,
projectScope: true,
keywords: ["run configuration", "rerun", "stop", "terminate"],
sections: [
{
options: [
{ kind: "toggle", key: "run.confirmRerun", label: "Confirm rerun with process termination" },
{ kind: "toggle", key: "run.confirmTerminate", label: "Confirm closing a tab with a running process" },
{
kind: "toggle",
key: "run.showOnStart",
label: "Show Run/Debug window when a process is started",
},
{
kind: "toggle",
key: "run.pinTabs",
label: "Make configurations pinned by default",
hint: "A finished pinned tab stays open: a later run opens a new tab instead of taking its place.",
},
{
kind: "number",
key: "run.terminationTimeoutMs",
label: "Time limit for Run/Debug process termination",
...L.terminationTimeoutMs,
integer: true,
step: 500,
unit: "ms",
hint: "After a configuration's stop command, the process gets this long to exit before it is interrupted. Press Stop again to kill a process that doesn't exit.",
},
],
},
],
},
];