[PR #2603] [MERGED] Add Dynamic Profile Generators #25002

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/2603
Author: @zadjii-msft
Created: 8/29/2019
Status: Merged
Merged: 9/16/2019
Merged by: @zadjii-msft

Base: masterHead: dev/migrie/f/dynamic-profiles


📝 Commits (10+)

  • 858341f Create profiles by layering them
  • 2074ac2 Update test to layer multiple times on the same profile
  • deb135f Add support for layering an array of profiles, but break a couple tests
  • e524ea7 Add a defaults.json to the package
  • 8157fd6 Layer colorschemes
  • 16336bb Layer an array of color schemes
  • 870fed3 Merge remote-tracking branch 'origin/master' into dev/migrie/f/754-layer-settings
  • 22e375d oh no, this was missed with #2481
  • 4e3c3c3 Layer keybindings
  • 2c2fa14 Read settings from defaults.json + profiles.json, layer appropriately

📊 Changes

23 files changed (+1788 additions, -338 deletions)

View changed files

📝 src/cascadia/LocalTests_TerminalApp/SettingsTests.cpp (+26 -13)
src/cascadia/TerminalApp/AzureCloudShellGenerator.cpp (+48 -0)
src/cascadia/TerminalApp/AzureCloudShellGenerator.h (+34 -0)
📝 src/cascadia/TerminalApp/CascadiaSettings.cpp (+16 -237)
📝 src/cascadia/TerminalApp/CascadiaSettings.h (+16 -14)
📝 src/cascadia/TerminalApp/CascadiaSettingsSerialization.cpp (+228 -11)
src/cascadia/TerminalApp/DefaultProfileUtils.cpp (+33 -0)
src/cascadia/TerminalApp/DefaultProfileUtils.h (+23 -0)
src/cascadia/TerminalApp/IDynamicProfileGenerator.h (+37 -0)
src/cascadia/TerminalApp/LegacyProfileGeneratorNamespaces.h (+21 -0)
src/cascadia/TerminalApp/PowershellCoreProfileGenerator.cpp (+90 -0)
src/cascadia/TerminalApp/PowershellCoreProfileGenerator.h (+36 -0)
📝 src/cascadia/TerminalApp/Profile.cpp (+229 -62)
📝 src/cascadia/TerminalApp/Profile.h (+9 -1)
📝 src/cascadia/TerminalApp/TerminalPage.cpp (+2 -0)
src/cascadia/TerminalApp/WslDistroGenerator.cpp (+118 -0)
src/cascadia/TerminalApp/WslDistroGenerator.h (+30 -0)
📝 src/cascadia/TerminalApp/lib/TerminalAppLib.vcxproj (+9 -0)
src/cascadia/ut_app/DynamicProfileTests.cpp (+677 -0)
📝 src/cascadia/ut_app/JsonTests.cpp (+60 -0)

...and 3 more files

📄 Description

This PR targets the #2515 PR. It does that for the sake of diffing. When this PR and #2515 are both ready, I'll merge #2515 first, then change the target of this branch, and merge this one.

Summary of the Pull Request

This PR adds support for "dynamic profiles", in accordance with the Cascading Settings Spec. Currently, we have three types of default profiles that fit the category of dynamic profile generators. These are profiles that we want to create on behalf of the user, but require runtime information to be able to create correctly. Because they require runtime information, we can't ship a static version of these profiles as a part of defaults.json. These three profile generators are:

  • The Powershell Core generator
  • The WSL Distro generator
  • The Azure Cloud Shell generator

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

We want to be able to enable the user to edit dynamic profiles that are generated from DPGs. When dynamic profiles are added, we'll add entries for them to the user's profiles.json. We do this without re-serializing the settings. Instead, we insert a partial serialization for the profile into the user's settings.

Remaining TODOs:

  • Make sure that dynamic profiles appear in the right place in the order of profiles -> #2722
  • don't serialize the colorTable key for dynamic profiles.
  • re-parse the user settings string if we've changed it.
  • Handle changing the default profile to pwsh if it exists on first launch, or file a follow-up issue -> #2721

Validation Steps Performed


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/2603 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 8/29/2019 **Status:** ✅ Merged **Merged:** 9/16/2019 **Merged by:** [@zadjii-msft](https://github.com/zadjii-msft) **Base:** `master` ← **Head:** `dev/migrie/f/dynamic-profiles` --- ### 📝 Commits (10+) - [`858341f`](https://github.com/microsoft/terminal/commit/858341f392c6431775e9beeaae0cd3543ea043eb) Create profiles by layering them - [`2074ac2`](https://github.com/microsoft/terminal/commit/2074ac201b3049b5030fedd7f146fa252f97b872) Update test to layer multiple times on the same profile - [`deb135f`](https://github.com/microsoft/terminal/commit/deb135f50d109b50327bcbbb5340386a3b41b011) Add support for layering an array of profiles, but break a couple tests - [`e524ea7`](https://github.com/microsoft/terminal/commit/e524ea75c29e3675b75d803ce75ec23c23dc25f1) Add a defaults.json to the package - [`8157fd6`](https://github.com/microsoft/terminal/commit/8157fd6195870e950cf86245c5269864d42af7c3) Layer colorschemes - [`16336bb`](https://github.com/microsoft/terminal/commit/16336bb6a52d10e5cdaa21e25536ed521603cc36) Layer an array of color schemes - [`870fed3`](https://github.com/microsoft/terminal/commit/870fed300288ec2943617b7a28050f94dfb65c9b) Merge remote-tracking branch 'origin/master' into dev/migrie/f/754-layer-settings - [`22e375d`](https://github.com/microsoft/terminal/commit/22e375dfbb1dfca0dcb57a06ae4858f29d59a8aa) oh no, this was missed with #2481 - [`4e3c3c3`](https://github.com/microsoft/terminal/commit/4e3c3c3919f62f24c1198507dc8c674c53b33c8a) Layer keybindings - [`2c2fa14`](https://github.com/microsoft/terminal/commit/2c2fa147d690df1903479251bf8eaae46bda77d8) Read settings from defaults.json + profiles.json, layer appropriately ### 📊 Changes **23 files changed** (+1788 additions, -338 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/LocalTests_TerminalApp/SettingsTests.cpp` (+26 -13) ➕ `src/cascadia/TerminalApp/AzureCloudShellGenerator.cpp` (+48 -0) ➕ `src/cascadia/TerminalApp/AzureCloudShellGenerator.h` (+34 -0) 📝 `src/cascadia/TerminalApp/CascadiaSettings.cpp` (+16 -237) 📝 `src/cascadia/TerminalApp/CascadiaSettings.h` (+16 -14) 📝 `src/cascadia/TerminalApp/CascadiaSettingsSerialization.cpp` (+228 -11) ➕ `src/cascadia/TerminalApp/DefaultProfileUtils.cpp` (+33 -0) ➕ `src/cascadia/TerminalApp/DefaultProfileUtils.h` (+23 -0) ➕ `src/cascadia/TerminalApp/IDynamicProfileGenerator.h` (+37 -0) ➕ `src/cascadia/TerminalApp/LegacyProfileGeneratorNamespaces.h` (+21 -0) ➕ `src/cascadia/TerminalApp/PowershellCoreProfileGenerator.cpp` (+90 -0) ➕ `src/cascadia/TerminalApp/PowershellCoreProfileGenerator.h` (+36 -0) 📝 `src/cascadia/TerminalApp/Profile.cpp` (+229 -62) 📝 `src/cascadia/TerminalApp/Profile.h` (+9 -1) 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+2 -0) ➕ `src/cascadia/TerminalApp/WslDistroGenerator.cpp` (+118 -0) ➕ `src/cascadia/TerminalApp/WslDistroGenerator.h` (+30 -0) 📝 `src/cascadia/TerminalApp/lib/TerminalAppLib.vcxproj` (+9 -0) ➕ `src/cascadia/ut_app/DynamicProfileTests.cpp` (+677 -0) 📝 `src/cascadia/ut_app/JsonTests.cpp` (+60 -0) _...and 3 more files_ </details> ### 📄 Description _**This PR targets the #2515 PR**_. It does that for the sake of diffing. When this PR and #2515 are both ready, I'll merge #2515 first, then change the target of this branch, and merge this one. <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request This PR adds support for "dynamic profiles", in accordance with the [Cascading Settings Spec](https://github.com/microsoft/terminal/blob/master/doc/cascadia/Cascading-Default-Settings.md#dynamic-profiles). Currently, we have three types of default profiles that fit the category of dynamic profile generators. These are profiles that we want to create on behalf of the user, but require runtime information to be able to create correctly. Because they require runtime information, we can't ship a static version of these profiles as a part of `defaults.json`. These three profile generators are: * The Powershell Core generator * The WSL Distro generator * The Azure Cloud Shell generator <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #754 * [x] I work here * [x] look at all these **Tests** * [x] Requires documentation to be updated - This is done as part of the parent PR <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments We want to be able to enable the user to edit dynamic profiles that are generated from DPGs. When dynamic profiles are added, we'll add entries for them to the user's `profiles.json`. We do this _without re-serializing_ the settings. Instead, we insert a partial serialization for the profile into the user's settings. ### Remaining TODOs: * Make sure that dynamic profiles appear in the right place in the order of profiles -> #2722 * [x] don't serialize the `colorTable` key for dynamic profiles. * [x] re-parse the user settings string if we've changed it. * Handle changing the default profile to pwsh if it exists on first launch, or file a follow-up issue -> #2721 <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:06:39 +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#25002