[PR #9926] Introduce serialization for actions #27815

Open
opened 2026-01-31 09:24:26 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/9926

State: closed
Merged: Yes


Summary of the Pull Request

This PR builds on the ActionMap PR (#6900) by leveraging ActionMap to serialize actions. From the top down, the process is now as follows:

  • CascadiaSettings: remove the hack of copying whatever we had for actions before.
  • GlobalAppSettings: serialize the ActionMap to "actions": []
  • ActionMap: iterate over the internal _ActionMap (list of actions) and serialize each Command
  • Command: THIS IS WHERE THE MAGIC HAPPENS! For each key mapping, serialize an action. Only the first one needs to include the name and icon.
  • ActionAndArgs: Find the relevant IActionArgs parser and serialize the ActionAndArgs.
  • ActionArgs: ANNOYING CHANGE Serialize any args that are set. We need each setting to be saved as a std::optional. As with inheritance, this allows us to distinguish an explicit setting to the default value (sometimes null) vs an implicit "give me the default value". This allows us to serialize only the relevant details of each action, rather than writing all of the args.

References

  • #8100: Inheritance/Layering for lists
    • This tracks layering and better serialization for color schemes and actions. This PR resolves half of that issue. The next step is to apply the concepts used in this PR (and #9621) to solve the similar problem for color schemes.
  • #6900: Actions page

Validation Steps Performed

Tests added!

**Original Pull Request:** https://github.com/microsoft/terminal/pull/9926 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request This PR builds on the `ActionMap` PR (#6900) by leveraging `ActionMap` to serialize actions. From the top down, the process is now as follows: - `CascadiaSettings`: remove the hack of copying whatever we had for actions before. - `GlobalAppSettings`: serialize the `ActionMap` to `"actions": []` - `ActionMap`: iterate over the internal `_ActionMap` (list of actions) and serialize each `Command` - `Command`: **THIS IS WHERE THE MAGIC HAPPENS!** For _each_ key mapping, serialize an action. Only the first one needs to include the name and icon. - `ActionAndArgs`: Find the relevant `IActionArgs` parser and serialize the `ActionAndArgs`. - `ActionArgs`: **ANNOYING CHANGE** Serialize any args that are set. We _need_ each setting to be saved as a `std::optional`. As with inheritance, this allows us to distinguish an explicit setting to the default value (sometimes `null`) vs an implicit "give me the default value". This allows us to serialize only the relevant details of each action, rather than writing _all_ of the args. ## References - #8100: Inheritance/Layering for lists - This tracks layering and better serialization for color schemes _and_ actions. This PR resolves half of that issue. The next step is to apply the concepts used in this PR (and #9621) to solve the similar problem for color schemes. - #6900: Actions page ## Validation Steps Performed Tests added!
claunia added the pull-request label 2026-01-31 09:24:26 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#27815