Skip to content

Feature Request: Cascading settings (with a hardcoded default.json?) #754

@DHowett-MSFT

Description

@DHowett-MSFT

Proposal

Include a default profiles.json in the package, allow the user to override it and merge their settings into it.

Questions

  • What if you want to delete a stock profile?
  • Optional features?
  • Turn off defaults? Perhaps {... "thing": null, }?

Child Work Items


Things that need to be done to accomplish Cascading Settings

Each <h3> here is a single PR into master, broken into either sub-PRs or work for me to do as a part of that PR

[x] Don't re-serialize settings on load (PR: #2475)

This should be done first and foremost. This is not really helping anyone. Old settings all migrate nicely, so whatever. Let's just pull it.

[_] Combine a defaults.json with a profiles.json (PR: #2515)

  • Add a defaults.json to the package
  • Create a function for layering a Json::Value on top of an existing object
  • Add tests for layering a profile json blob on top of a profile
  • Add functions to search a list of Profiles for a duplicate, and layer on that dupe or create a new Profile if no such dupe exists.
  • Ensure we can layer each of the following: (WITH TESTS)
    • layer profiles
    • layer color schemes
    • layer keybindings (for a matching key, the user action should override the default action) (NEEDS TESTS)
    • layer globals (NEEDS TESTS)
  • When loading settings, load defaults, then layer user settings on top of default profiles
  • Maintain user settings ordering, not defaults+user ordering
  • Add support for unbinding default keys
    • unbind with "unbound"
    • unbind with null
  • Add support for hiding profiles
  • Ensure that we can reset optional default settings with null (e.g. "iconPath": null)
  • Create the User Settings file if it doesn't exist
  • Stamp the "defaults.json" file into the code, so we can't possibly fail loading it
  • Add support for Alt clicking on "settings" to launch the defaults.json file
  • default construct profiles with scheme "Campbell" to make "scheme" and unnecessary setting in the partial diff

[_] Add Dynamic Profile Generators

  • Add Dynamic Profile Generator for WSL
    • Create Dynamic Profile Generator interface
    • Provide DPG's with GetNamespaceGuid and GetGuidForName functions from App somehow We're not doing this anymore. We'll create the GUID for the profile when it's returned, if it has a GUID of {0}
      • Add a test for generateing a guid based on namespace if GUID is {0}
    • Add layering for dynamic profiles based on guid and source, not just guid
  • Add Dynamic Profile Generator for Powershell Core
  • Add Dynamic Profile Generator for Azure Cloud Shell
  • Ensure that existing WSL, Powershell Core, and Azure profiles gracefully migrate to dynamic profiles
  • Add disabledProfileSources in user settings to hide dynamic profiles by namespace
  • On first launch of the terminal, if Powershell Core exists, make it the default profile
  • When adding this profiles, insert them into our JSON parse tree to save them
    • Only add the delta between the default profile and the dynamic profile's default state to the json. Don't include any user customizations (though at this point there won't be any)
  • Ensure adding a dynamic entry doesn't reformat settings
  • For profiles that were created from a dynamic profile source, they'll have both a guid and source guid that must both match. If a user profile with a source set does not find a matching profile at load time, the profile should be ignored.
  • profile diffs should probably not include "table". Probably don't need to include in the diff keys that are std::nullopt in both the base and derived.
  • Make sure to re-order profiles so they're { user profiles, dynamics not in user profiles, defaults not in user profiles }

[_] Smart Serializing

This would be needed for a Settings UI, so we don't necessarily need it for 1.0

  • Keep the original JSON parse tree around in memory
  • Only serialize things different from defaults
    • profiles
    • schemes
    • keybindings

Metadata

Metadata

Assignees

Labels

Area-SettingsIssues related to settings and customizability, for console or terminalIssue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Product-TerminalThe new Windows Terminal.Resolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions