Порівняти коміти

...
4 Коміти
Автор SHA1 Повідомлення Дата
l0ng-ai 745099feaa chore: v0.1.56 2026-11-30 15:07:20 +08:00
l0ng-ai 6894d0a4e3 fix(web): declare the GTK dialog probe and hotkey probe as always allowed in the web shell (#6967)
file_dialog_needs_gtk and system_probe_hotkeys are trust = always on the desktop, but the web shell table still declared them Trusted, so commands::tests::web_shell_commands_match_the_desktop_declarations failed on every Rust job on main.
2026-11-30 15:06:25 +08:00
l0ng-ai f80be658ea fix(run-targets): apply a published ports edit that hasn't left the field (#6966)
Published ports and the other list fields of a run target were stored only on blur, so OK pressed with Enter, or applying the settings while the field still had focus, dropped the edit. The list is now staged on every change; the text stays as typed while the field has focus.
2026-11-30 15:01:45 +08:00
l0ng-ai 1c377b7f66 fix(run): show configuration types in the UI language in Add New Configuration (#6965)
The Add New Configuration type picker and the Edit Configurations Templates list showed each type's English label while the form showed the translation. Rows now carry the translated label, which the list also sorts and searches by.
2026-11-30 15:01:28 +08:00
41 змінених файлів з 196 додано та 108 видалено

No files matched your search

Створено
+48 -48
Переглянути файл
@@ -4154,7 +4154,7 @@ checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
[[package]]
name = "ide-agent"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"base64 0.22.1",
"blake3",
@@ -4183,7 +4183,7 @@ dependencies = [
[[package]]
name = "ide-analysis"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"ast-grep-core",
"ide-core",
@@ -4195,7 +4195,7 @@ dependencies = [
[[package]]
name = "ide-android"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"ide-core",
"serde",
@@ -4207,7 +4207,7 @@ dependencies = [
[[package]]
name = "ide-build"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"blake3",
"chardetng",
@@ -4225,7 +4225,7 @@ dependencies = [
[[package]]
name = "ide-cli"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"dirs 6.0.0",
"serde",
@@ -4239,7 +4239,7 @@ dependencies = [
[[package]]
name = "ide-clipboard"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"gtk",
"objc2 0.6.5",
@@ -4250,7 +4250,7 @@ dependencies = [
[[package]]
name = "ide-command"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"heck 0.5.0",
"proc-macro2",
@@ -4261,7 +4261,7 @@ dependencies = [
[[package]]
name = "ide-core"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"base64 0.22.1",
"dirs 6.0.0",
@@ -4283,7 +4283,7 @@ dependencies = [
[[package]]
name = "ide-coverage"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"ide-core",
"ide-run",
@@ -4296,7 +4296,7 @@ dependencies = [
[[package]]
name = "ide-dap"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"base64 0.22.1",
"futures",
@@ -4326,7 +4326,7 @@ dependencies = [
[[package]]
name = "ide-db"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"base64 0.22.1",
"bb8",
@@ -4365,7 +4365,7 @@ dependencies = [
[[package]]
name = "ide-docker"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"ide-core",
"serde",
@@ -4378,7 +4378,7 @@ dependencies = [
[[package]]
name = "ide-drag-out"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"gtk",
"objc2 0.6.5",
@@ -4392,7 +4392,7 @@ dependencies = [
[[package]]
name = "ide-extension"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"base64 0.22.1",
"blake3",
@@ -4412,7 +4412,7 @@ dependencies = [
[[package]]
name = "ide-flutter"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"ide-android",
"ide-core",
@@ -4423,7 +4423,7 @@ dependencies = [
[[package]]
name = "ide-fonts"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"objc2-core-foundation",
"objc2-core-text",
@@ -4435,7 +4435,7 @@ dependencies = [
[[package]]
name = "ide-github"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"ide-core",
"ide-vcs",
@@ -4447,7 +4447,7 @@ dependencies = [
[[package]]
name = "ide-heap"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"criterion",
"ide-core",
@@ -4466,7 +4466,7 @@ dependencies = [
[[package]]
name = "ide-host"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"base64 0.22.1",
"blake3",
@@ -4549,7 +4549,7 @@ dependencies = [
[[package]]
name = "ide-http"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"base64 0.22.1",
"http",
@@ -4572,7 +4572,7 @@ dependencies = [
[[package]]
name = "ide-index"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"blake3",
"criterion",
@@ -4595,7 +4595,7 @@ dependencies = [
[[package]]
name = "ide-jdwp"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"ide-jvm-inspect",
"proptest",
@@ -4607,7 +4607,7 @@ dependencies = [
[[package]]
name = "ide-jsonrpc"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"encoding_rs",
"ide-core",
@@ -4623,7 +4623,7 @@ dependencies = [
[[package]]
name = "ide-jvm-attach"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"libc",
"tempfile",
@@ -4632,7 +4632,7 @@ dependencies = [
[[package]]
name = "ide-jvm-inspect"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"futures",
"serde",
@@ -4643,7 +4643,7 @@ dependencies = [
[[package]]
name = "ide-language"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"blake3",
"criterion",
@@ -4702,7 +4702,7 @@ dependencies = [
[[package]]
name = "ide-lsp"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"criterion",
"dunce",
@@ -4732,7 +4732,7 @@ dependencies = [
[[package]]
name = "ide-mcp"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"bytes",
"dunce",
@@ -4751,7 +4751,7 @@ dependencies = [
[[package]]
name = "ide-notebook"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"futures",
"ide-core",
@@ -4776,7 +4776,7 @@ dependencies = [
[[package]]
name = "ide-plugin"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"blake3",
"dunce",
@@ -4798,7 +4798,7 @@ dependencies = [
[[package]]
name = "ide-profiler"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"ide-core",
"ide-jvm-attach",
@@ -4812,7 +4812,7 @@ dependencies = [
[[package]]
name = "ide-remote"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"dunce",
"futures",
@@ -4832,7 +4832,7 @@ dependencies = [
[[package]]
name = "ide-run"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"blake3",
"dunce",
@@ -4858,7 +4858,7 @@ dependencies = [
[[package]]
name = "ide-scaffold"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"ide-core",
"ide-tools",
@@ -4874,7 +4874,7 @@ dependencies = [
[[package]]
name = "ide-sdk"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"base64 0.22.1",
"dirs 6.0.0",
@@ -4900,7 +4900,7 @@ dependencies = [
[[package]]
name = "ide-search"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"criterion",
"encoding_rs",
@@ -4921,7 +4921,7 @@ dependencies = [
[[package]]
name = "ide-spell"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"ide-core",
"parking_lot 0.12.5",
@@ -4934,7 +4934,7 @@ dependencies = [
[[package]]
name = "ide-ssh"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"dirs 6.0.0",
"flate2",
@@ -4959,7 +4959,7 @@ dependencies = [
[[package]]
name = "ide-streams"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"ide-core",
"ide-language",
@@ -4972,7 +4972,7 @@ dependencies = [
[[package]]
name = "ide-syntax"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"ide-core",
"ide-language",
@@ -4987,7 +4987,7 @@ dependencies = [
[[package]]
name = "ide-terminal"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"ide-core",
"libc",
@@ -5001,7 +5001,7 @@ dependencies = [
[[package]]
name = "ide-text"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"criterion",
"ide-core",
@@ -5014,7 +5014,7 @@ dependencies = [
[[package]]
name = "ide-tools"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"base64 0.22.1",
"blake3",
@@ -5041,7 +5041,7 @@ dependencies = [
[[package]]
name = "ide-vcs"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"blake3",
"dunce",
@@ -5063,7 +5063,7 @@ dependencies = [
[[package]]
name = "ide-vfs"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"chardetng",
"dunce",
@@ -5090,7 +5090,7 @@ dependencies = [
[[package]]
name = "ide-web"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"dirs 6.0.0",
"ide-core",
@@ -5106,7 +5106,7 @@ dependencies = [
[[package]]
name = "ide-workspace"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"blake3",
"dunce",
@@ -6754,7 +6754,7 @@ dependencies = [
[[package]]
name = "openidea"
version = "0.1.55"
version = "0.1.56"
dependencies = [
"base64 0.22.1",
"blake3",
+1 -1
Переглянути файл
@@ -5,7 +5,7 @@ members = ["crates/*", "src-tauri"]
exclude = ["sdk", "plugins"]
[workspace.package]
version = "0.1.55"
version = "0.1.56"
edition = "2024"
rust-version = "1.96"
license = "Apache-2.0"
+2 -2
Переглянути файл
@@ -370,7 +370,7 @@ pub fn register(dispatcher: &mut Dispatcher, shell: Arc<WebShellState>) {
("window_toggle_zoom", Always),
("window_start_drag", Always),
("window_drag_files", Always),
("file_dialog_needs_gtk", Trusted),
("file_dialog_needs_gtk", Always),
("clipboard_has_files", Always),
("clipboard_has_image", Always),
] {
@@ -387,7 +387,7 @@ pub fn register(dispatcher: &mut Dispatcher, shell: Arc<WebShellState>) {
for (empty_list, trust) in [
("window_group_current", Always),
("system_font_families", Always),
("system_probe_hotkeys", Trusted),
("system_probe_hotkeys", Always),
("wsl_distros", Always),
("web_browsers", Always),
("plugin_catalog", Always),
+1 -1
Переглянути файл
@@ -2,7 +2,7 @@
"name": "openidea",
"private": true,
"description": "An open-source IDE inspired by IntelliJ IDEA",
"version": "0.1.55",
"version": "0.1.56",
"license": "Apache-2.0",
"type": "module",
"scripts": {
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Forking recorded native agent sessions into new tasks (API 1.18). Requires
/// the `agents` capability. The session must belong to the invoking window's
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// The commit being prepared in the window the current command or event came
/// from (the Commit tool window, or the Commit dialog while it is open): the
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Optional export (API 1.16, world `plugin-completion-list`): completion that
/// can say its list is incomplete. A plugin exporting it is called instead of
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Plugin-owned project data sources. Requires database.sources and project trust.
/// Runs on the Database subsystem's host, including on remote project servers.
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Editor and project-tree decorations (API 1.4). Requires project.read. An editor set
/// follows its file: the file's own project, or the nearest one when it is outside them all.
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// What the pane beside the Services tree shows for a plugin's node.
interface detail-types {
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Optional export (world `plugin-diagnostics`): problems in the current,
/// possibly unsaved document, for the languages declared with the
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// HTTP endpoints found in a project (`[[contributes.endpoints]]`).
interface endpoints-provider {
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Workbench events, delivered in batches to `event-handler.handle`.
interface events {
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
interface lifecycle {
use types.{context, error};
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// What other plugins contributed to the extension points this plugin declares
/// (`[[extension-points]]` in `plugin.toml`; the contributors list this plugin
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Optional export (world `plugin-file-actions`): quick fixes and
/// refactorings that create, rename or delete files, next to the text edits
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Files outside the open projects: the configuration of the program a
/// plugin integrates with, a tool installed elsewhere, a licence file.
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Writes to the IDE log, tagged with the plugin id.
interface log {
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Optional export (world `plugin-hover-actions`): clickable actions rendered
/// at the left edge of a line and revealed while the pointer is in the leftmost
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Optional export (world `plugin-hover`): Markdown added to the hover of
/// documents of the languages declared with the `hover` provider kind,
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Cross-file associations a plugin publishes for the files it declares under
/// `[[contributes.documentIndexers]]`. The host calls `index` in cancellable
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Embedded languages. The host routes plugin providers and configured language
/// servers inside these ranges, preserving host-document UTF-16 coordinates.
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Optional export (world `plugin-inlay-hints`): inline hints in documents of
/// the languages declared with the `inlay-hints` provider kind, including
+27 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Problems in files, shown in the editor and the Problems view.
interface diagnostics {
@@ -108,6 +108,32 @@ interface net {
/// project binding, so resource methods cannot be redirected to another
/// project.
websocket-connect: func(project: borrow<project>, req: websocket-request) -> result<websocket, error>;
record body-chunk {
bytes: list<u8>,
/// The body has ended: this read and every later one return no more bytes.
done: bool,
}
/// A response whose body is read as it arrives: server-sent events, a
/// model's streamed reply (API 1.19). At most eight may be open for a
/// plugin. Dropping this resource closes the connection, as does stopping
/// the plugin.
resource response-stream {
status: func() -> u16;
headers: func() -> list<header>;
/// The next bytes of the body, at most `max-bytes` (and 1 MiB). Waits
/// up to `timeout-ms` for them within the call's budget and returns
/// none, with `done` false, when nothing arrived in time; zero only
/// takes what has already arrived.
read: func(max-bytes: u32, timeout-ms: u32) -> result<body-chunk, error>;
close: func();
}
/// As `fetch`, with the same grants, secrets and redirects, but returns
/// once the response headers arrive (API 1.19). `timeout-ms` bounds the
/// wait for the headers; the body has no overall limit.
fetch-stream: func(req: request) -> result<response-stream, error>;
}
/// Secrets the user stored for the plugin (Settings › Plugins, kept in the
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Additional language features, called only for declared API 1.4 provider kinds.
/// Editor calls have a 50 ms soft / 500 ms hard budget; formatting has 5 seconds.
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Discovery of the IDE's built-in MCP server; never exposes its URL or token.
interface mcp {
+1 -1
Переглянути файл
@@ -8,7 +8,7 @@
/// `fs` and `workspace`, and everything else goes through the imports below,
/// gated by the capabilities granted in `plugin.toml` (a missing one returns
/// `error::denied`).
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
world plugin {
import log;
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Editor features a plugin provides for the languages it declares under
/// `[[contributes.providers]]` (the host calls only declared kinds). They run
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Project-scoped targets owned by the registering plugin (API 1.4).
interface run-targets {
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Launches this plugin's configurations in the invoking window's Run tool window.
interface run {
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// On-demand results for `[[contributes.searchCategories]]`. Optional, API 1.13.
interface search-provider {
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Optional export (world `plugin-semantic-tokens`): semantic colouring of
/// documents of the languages declared with the `semantic-tokens` provider
+1 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Shared types. Positions are 0-based lines and UTF-16 code unit columns,
/// as in the editor and LSP.
+13 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
/// Declarative views: tool windows declared
/// under `[[contributes.views]]` and custom editors under
@@ -203,8 +203,20 @@ interface views {
/// The plugin's own settings (`[contributes.settings]`), as the user set them
/// (project over global) or the schema's default.
interface settings {
use types.{error};
/// The value of `key` as JSON (`true`, `3`, `"text"`), none if unknown.
get: func(key: string) -> option<string>;
/// Opens Settings at one of the plugin's own pages in the window the
/// current command or event came from (API 1.19): `page` is the `id` of a
/// `[[contributes.settings.pages]]` entry, none for the plugin's settings
/// node itself. `invalid` outside a window's command or event, `not-found`
/// for a page the plugin does not declare (or without `[contributes.settings]`).
open: func(page: option<string>) -> result<_, error>;
/// Opens Settings › Plugins at this plugin's permissions, where the user
/// grants an optional capability it lacks (API 1.19). `invalid` outside a
/// window's command or event.
open-permissions: func() -> result<_, error>;
}
/// Optional export (world `plugin-views`): content of declared views and
+5 -1
Переглянути файл
@@ -1,4 +1,4 @@
package openidea:[email protected]8.0;
package openidea:[email protected]9.0;
interface workspace {
use types.{error, location};
@@ -137,6 +137,10 @@ interface editor {
/// the plugin's install directory, selecting a range. Only from
/// commands/events of a window. Paths follow views.open-location.
open: func(path: string, selection: option<range>) -> result<_, error>;
/// `open` in the built-in text editor even when a custom editor claims
/// the file, as the IDE's own "Open as Text" does: the same document,
/// undo history and Save (API 1.19).
open-as-text: func(path: string, selection: option<range>) -> result<_, error>;
/// Current version and text of an open project document. Unlike
/// `text-editor.document`, this is available to background events.
+1 -1
Переглянути файл
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "OpenIDEA",
"version": "0.1.55",
"version": "0.1.56",
"identifier": "ai.l0ng.openidea",
"build": {
"beforeDevCommand": "pnpm dev",
+34 -12
Переглянути файл
@@ -13,32 +13,48 @@ import {
type PopupAnchor,
} from "@/ui";
import { useRowHeight } from "@/ui/density";
import { useTx } from "@/platform/i18n";
import { useRunConfigTypes, runConfigTypes, type RunConfigTypeContribution } from "@/workbench/contributions";
import styles from "./Run.module.css";
export type TypeRow =
| { kind: "group"; key: string; label: string }
| { kind: "type"; key: string; type: RunConfigTypeContribution; indices: number[] | null; nested: boolean };
| {
kind: "type";
key: string;
type: RunConfigTypeContribution;
/** The type's label in the UI language: what the row shows and the query matches. */
label: string;
indices: number[] | null;
nested: boolean;
};
const ROW = 24;
/** "Add New Configuration" rows: types by label, grouped ones under their group; filtered by `query`. */
export function typeRows(types: readonly RunConfigTypeContribution[], query: string): TypeRow[] {
/**
* "Add New Configuration" rows: types by label, grouped ones under their group; filtered by `query`. Labels and groups
* go through `translate` first, so the list is sorted, shown and searched in the UI language.
*/
export function typeRows(
types: readonly RunConfigTypeContribution[],
query: string,
translate: (text: string) => string = (text) => text,
): TypeRow[] {
const q = query.trim();
const match = (t: RunConfigTypeContribution) =>
q ? (fuzzyMatch(t.label, q) ?? (t.group && fuzzyMatch(t.group, q) ? [] : null)) : null;
q ? (fuzzyMatch(translate(t.label), q) ?? (t.group && fuzzyMatch(translate(t.group), q) ? [] : null)) : null;
const rows: TypeRow[] = [];
const groups = new Map<string, RunConfigTypeContribution[]>();
const entries: Array<{ label: string; group?: string; type?: RunConfigTypeContribution }> = [];
for (const t of types) {
if (!t.group) {
entries.push({ label: t.label, type: t });
entries.push({ label: translate(t.label), type: t });
continue;
}
let g = groups.get(t.group);
if (!g) {
groups.set(t.group, (g = []));
entries.push({ label: t.group, group: t.group });
entries.push({ label: translate(t.group), group: t.group });
}
g.push(t);
}
@@ -46,7 +62,8 @@ export function typeRows(types: readonly RunConfigTypeContribution[], query: str
for (const e of entries) {
if (e.type) {
const indices = match(e.type);
if (!q || indices) rows.push({ kind: "type", key: e.type.id, type: e.type, indices, nested: false });
if (!q || indices)
rows.push({ kind: "type", key: e.type.id, type: e.type, label: e.label, indices, nested: false });
continue;
}
const members = groups
@@ -54,8 +71,9 @@ export function typeRows(types: readonly RunConfigTypeContribution[], query: str
.map((t) => ({ t, indices: match(t) }))
.filter((x) => !q || x.indices);
if (!members.length) continue;
rows.push({ kind: "group", key: `group:${e.group}`, label: e.group! });
for (const { t, indices } of members) rows.push({ kind: "type", key: t.id, type: t, indices, nested: true });
rows.push({ kind: "group", key: `group:${e.group}`, label: e.label });
for (const { t, indices } of members)
rows.push({ kind: "type", key: t.id, type: t, label: translate(t.label), indices, nested: true });
}
return rows;
}
@@ -73,7 +91,8 @@ export function AddConfigPopup({
const types = useRunConfigTypes((s) => s.types);
const rowHeight = useRowHeight(ROW);
const [query, setQuery] = useState("");
const rows = useMemo(() => typeRows(runConfigTypes(types), query), [types, query]);
const tx = useTx();
const rows = useMemo(() => typeRows(runConfigTypes(types), query, tx), [types, query, tx]);
const isSection = (r: TypeRow) => r.kind === "group";
const [active, setActive] = useState(-1);
const clamped = Math.min(active, rows.length - 1);
@@ -149,10 +168,13 @@ export function AddConfigPopup({
}
renderItem={(r) =>
r.kind === "type" ? (
<span className={clsx(styles.chooserRow, r.nested && styles.typeNested)} title={r.type.description}>
<span
className={clsx(styles.chooserRow, r.nested && styles.typeNested)}
title={r.type.description && tx(r.type.description)}
>
<Icon name={r.type.icon} size={16} className={styles.chooserIcon} />
<span className={styles.chooserName}>
{r.indices?.length ? <HighlightedText text={r.type.label} indices={r.indices} /> : r.type.label}
{r.indices?.length ? <HighlightedText text={r.label} indices={r.indices} /> : r.label}
</span>
</span>
) : null
+1 -1
Переглянути файл
@@ -647,7 +647,7 @@ function EditConfigsDialog() {
onClick={() => setSelection({ type: "template", kind: t.id })}
>
<Icon name={t.icon} size={13} className={styles.chooserIcon} />
<span className={styles.chooserName}>{t.label}</span>
<span className={styles.chooserName}>{tx(t.label)}</span>
</button>
);
})}
+14
Переглянути файл
@@ -796,6 +796,20 @@ describe("configuration types", () => {
expect(typeRows(types, "grad").map((r) => r.key)).toEqual(["gradle"]);
expect(typeRows(types, "dock").map((r) => r.key)).toEqual(["group:Docker", "docker-image"]);
});
it("Add New Configuration shows, sorts and searches types in the UI language", () => {
const zh: Record<string, string> = { Compound: "复合", "Docker Image": "Docker 镜像", Docker: "Docker 组" };
const translate = (text: string) => zh[text] ?? text;
const types = [
...runConfigTypes(),
{ ...BUILTIN_TYPES[0]!, id: "docker-image", label: "Docker Image", group: "Docker" },
];
const rows = typeRows(types, "", translate);
expect(rows.find((r) => r.kind === "type" && r.type.id === "compound")).toMatchObject({ label: "复合" });
expect(rows.find((r) => r.kind === "group")).toMatchObject({ label: "Docker 组" });
expect(typeRows(types, "复合", translate).map((r) => r.key)).toEqual(["compound"]);
expect(typeRows(types, "镜像", translate).map((r) => r.key)).toEqual(["group:Docker", "docker-image"]);
});
});
describe("compound configurations", () => {
+15 -6
Переглянути файл
@@ -43,17 +43,26 @@ afterEach(() => {
});
describe("Run Targets detail form", () => {
it("does not commit an uncommitted ports edit to the target selected while it is open", () => {
it("keeps a ports edit with the target it was made to when another target is selected", () => {
mount();
// An edit to odoo110's published ports that ListField has not committed yet.
// An edit to odoo110's published ports, still focused.
fireEvent.change(portsBox(), { target: { value: "8069" } });
// Selecting another target switches selection on mousedown, before the blur commits.
// Selecting another target switches selection on mousedown, before the field loses focus.
fireEvent.mouseDown(screen.getByRole("option", { name: /odoo170/ }));
fireEvent.blur(portsBox());
// odoo170 keeps its own ports; the uncommitted draft is not written over them.
// odoo170 keeps its own ports; the edit is not written over them.
expect(portsBox().value).toBe("9000:9000");
// And odoo110 still holds what it held before the edit was committed anywhere.
// And odoo110 holds the edit.
fireEvent.mouseDown(screen.getByRole("option", { name: /odoo110/ }));
expect(portsBox().value).toBe("8069:8069");
expect(portsBox().value).toBe("8069");
});
it("stages a ports edit before the field loses focus, so OK applies it", () => {
mount();
fireEvent.change(portsBox(), { target: { value: "8069:8069 8070:8070" } });
expect(portsBox().value).toBe("8069:8069 8070:8070");
const change = Object.values(useSettingsDialog.getState().staged).find((c) => c.key === "runTargets");
const targets = change?.value as Array<{ id: string; ports: string[] }> | undefined;
expect(targets?.find((t) => t.id === "odoo110")?.ports).toEqual(["8069:8069", "8070:8070"]);
});
});
+6 -5
Переглянути файл
@@ -263,7 +263,8 @@ function ListField({
hint?: string;
}) {
const id = useId();
// Edited as text; the list is stored once the field loses focus.
// Edited as text, which stays as typed while the field has focus; the list is stored on every change, so OK
// (Enter included) applies an edit that hasn't left the field.
const [draft, setDraft] = useState<string | null>(null);
return (
<Row label={label} htmlFor={id} className={styles.alignedRow} hint={hint}>
@@ -273,11 +274,11 @@ function ListField({
className={styles.wide}
value={draft ?? value.join(" ")}
placeholder={placeholder}
onChange={(e) => setDraft(e.target.value)}
onBlur={() => {
if (draft !== null) onChange(splitList(draft));
setDraft(null);
onChange={(e) => {
setDraft(e.target.value);
onChange(splitList(e.target.value));
}}
onBlur={() => setDraft(null)}
/>
</Row>
);