Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions rust/contracts/run-configuration-v2.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@
},
"additionalProperties": true
},
"arrangement": {
"type": "object",
"description": "Machine-local order of the run configuration list. Stored only in the local layer; omitted means sorted by name.",
"properties": {
"sortAlphabetically": { "type": "boolean" },
"order": {
"type": "array", "maxItems": 4096, "uniqueItems": true,
"items": { "type": "string", "minLength": 1, "maxLength": 4096 }
}
},
"additionalProperties": false
},
"configurations": {
"type": "array",
"items": { "$ref": "#/$defs/configuration" }
Expand Down Expand Up @@ -181,6 +193,11 @@
"properties": {
"id": { "type": "string", "minLength": 1 },
"name": { "type": "string", "minLength": 1 },
"folder": {
"type": "string", "minLength": 1, "maxLength": 256,
"pattern": "^[^\\s\\p{Cc}](?:[^\\p{Cc}]*[^\\s\\p{Cc}])?$",
"description": "Folder the configuration is listed in within its kind; display only."
},
"provider": {
"type": "string",
"pattern": "^[a-z][a-z0-9-]*\\.[a-z][a-z0-9-]*$"
Expand Down
43 changes: 43 additions & 0 deletions rust/contracts/rust-core-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,8 @@ or removing a command fails until the table changes in the same commit.
| `runConfig.editorForm` | Describe the editor fields and current values of a built-in run configuration |
| `runConfig.saveConfiguration` | Validate an editor form's values and return field errors or the file changes that save it |
| `runConfig.deleteConfiguration` | Return the file changes that delete a saved user configuration |
| `runConfig.copyConfiguration` | Return the file changes that save a copy of any configuration under a new name |
| `runConfig.arrange` | Return the file changes that move configurations between folders and save the list order |
| `runConfig.beforeLaunch` | Expand the built-in process runs a configuration starts first, and say whether the user must confirm them |
| `runConfig.createLaunchPlan` | Project one effective configuration into a platform-neutral Run or Debug plan |
| `runConfig.providerLaunchInputs` | Resolve user choices for a provider-owned launch |
Expand Down Expand Up @@ -3965,6 +3967,47 @@ extension namespaces the editor does not show are kept.
returns `{changes}` that remove the saved `user:` configuration from every layer.
Generated entries cannot be deleted.

`runConfig.copyConfiguration` accepts `{root, configurationId, name, plugins?}`
and replies `{id, changes}`: the copy's new `user:` ID and the changes that
save it. The copy is the resolved configuration with every saved choice, its
folder included, under the new ID and `name` (trimmed, 1 to 256 bytes). It is
saved in the project layer when the original is a user configuration defined
there without a local override, and in the local layer otherwise, so local
choices never reach the team. A saved `build.provider` run supersedes the
generated run with the same selector, so copying a generated one also saves the
original whole in the local layer under its own ID; both stay listed, and the
original stops following later name changes of the build model.

#### Folders and order

A configuration may name a `folder`, the folder it is listed in within its
kind (IntelliJ IDEA's `folderName`): 1 to 256 bytes, without surrounding
whitespace or control characters. A folder is display metadata saved in the
configuration, so a project configuration carries its folder to the team, and
a local entry `{id, folder}` overrides it like any other key; launching
ignores it. An invalid folder makes the configuration unavailable
(`invalidConfiguration`).

The order of the list and whether it is sorted by name are this machine's
choice, saved only in the local Lithe document under `arrangement:
{sortAlphabetically?: boolean, order?: string[]}`. The default sorts by name,
ignoring case. `runConfig.resolve` returns the configurations in the order the
list shows them and adds `sortAlphabetically`: by name when sorted, otherwise in
the saved `order`, with the configurations it does not name after it by name;
IDs that no longer resolve are skipped. A malformed `arrangement` is ignored
and reported as the `invalidArrangement` diagnostic.

`runConfig.arrange` accepts `{root, folders?, order?, sortAlphabetically?,
plugins?}` and returns `{changes}`. `folders` maps configuration IDs to the
folder each moves to, or `null` to take it out of its folder; each ID must
resolve. The folder is written to the layer that defines the configuration:
the project layer for a configuration saved there, otherwise the local layer,
where a generated configuration gets a sparse `{id, folder}` entry, and the
other layer's folder for it is removed. `order` replaces the whole saved order
(at most 4,096 IDs, repeats dropped) and `sortAlphabetically` the sort choice;
an omitted field keeps the saved value, and saving the defaults removes
`arrangement`. Nothing to change returns no changes.

#### Steps before launch

A configuration of any provider may name `beforeLaunch`, an ordered list of at
Expand Down
8 changes: 8 additions & 0 deletions rust/crates/core/src/protocol/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,10 @@ pub enum RunConfigCommand {
SaveConfiguration,
/// Removes a user-authored run configuration (`runConfig.deleteConfiguration`).
DeleteConfiguration,
/// Saves a copy of a configuration under a new name (`runConfig.copyConfiguration`).
CopyConfiguration,
/// Moves configurations between folders and saves the list order (`runConfig.arrange`).
Arrange,
/// Expands the steps run before a configuration starts (`runConfig.beforeLaunch`).
BeforeLaunch,
/// Produces the process plan for one configuration (`runConfig.createLaunchPlan`).
Expand Down Expand Up @@ -1440,6 +1444,10 @@ impl CoreCommand {
"runConfig.deleteConfiguration" => {
Some(Self::RunConfig(RunConfigCommand::DeleteConfiguration))
}
"runConfig.copyConfiguration" => {
Some(Self::RunConfig(RunConfigCommand::CopyConfiguration))
}
"runConfig.arrange" => Some(Self::RunConfig(RunConfigCommand::Arrange)),
"runConfig.beforeLaunch" => Some(Self::RunConfig(RunConfigCommand::BeforeLaunch)),
"runConfig.createLaunchPlan" => {
Some(Self::RunConfig(RunConfigCommand::CreateLaunchPlan))
Expand Down
30 changes: 30 additions & 0 deletions rust/crates/core/src/runtime/dispatcher/run_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,36 @@ pub(super) fn dispatch(
Err(error) => CoreResponse::failure(id, error),
}
}
RunConfigCommand::CopyConfiguration => {
match serde_json::from_value::<crate::execution::CopyConfigurationRequest>(payload)
.map_err(|error| {
CoreError::new(
ErrorCode::InvalidRequest,
"Invalid run configuration copy request",
)
.with_details(error.to_string())
})
.and_then(crate::execution::copy_configuration)
{
Ok(data) => CoreResponse::success(id, data),
Err(error) => CoreResponse::failure(id, error),
}
}
RunConfigCommand::Arrange => {
match serde_json::from_value::<crate::execution::ArrangeRequest>(payload)
.map_err(|error| {
CoreError::new(
ErrorCode::InvalidRequest,
"Invalid run configuration arrange request",
)
.with_details(error.to_string())
})
.and_then(crate::execution::arrange)
{
Ok(data) => CoreResponse::success(id, data),
Err(error) => CoreResponse::failure(id, error),
}
}
RunConfigCommand::ProviderLaunchInputs => {
match serde_json::from_value::<crate::execution::ProviderLaunchInputsRequest>(payload)
.map_err(|error| {
Expand Down
1 change: 1 addition & 0 deletions rust/crates/core/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ mod remote_sessions;
mod request_events;
mod row_selection;
mod run_configuration;
mod run_configuration_arrangement;
pub(crate) mod support;
mod toolchain_definitions;
mod toolchain_pins;
Expand Down
Loading
Loading