Conversation
TODO for this PR
(new items!)
(new items 2!)
(new items 3!)
|
src/inc/til/coalesce.h
Outdated
| // Method Description: | ||
| // - Base case provided to throw an assertion if you call coalesce_value(opt, opt, opt) | ||
| template<typename T> | ||
| T coalesce_value(const winrt::Windows::Foundation::IReference<T>& base) |
There was a problem hiding this comment.
til cannot have an unguarded reference to IReference. til is conceptually below things that use winrt.
There was a problem hiding this comment.
oh i see, you.. did the thing i did in JsonUtils. Clever.
src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp
Outdated
Show resolved
Hide resolved
src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp
Outdated
Show resolved
Hide resolved
src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp
Outdated
Show resolved
Hide resolved
|
must-fix:
pleasant to have:
|
| Windows::Foundation::Collections::IMap<hstring, Model::ColorScheme> _colorSchemes; | ||
| Windows::Foundation::Collections::IMap<hstring, Model::Command> _commands; | ||
|
|
||
| std::optional<hstring> _getUnparsedDefaultProfileImpl() const; |
There was a problem hiding this comment.
how is this different from GETSET_SETTING?
There was a problem hiding this comment.
The setter for UnparsedDefaultProfile needs to set _validDefaultProfile to false. We need this to validate that the provided "defaultProfile" value actually maps to something.
| // Special case the legacy dynamic profiles here. In this case, | ||
| // `this` is a dynamic profile with a source, and our _source is one | ||
| // of the legacy DPG namespaces. We're looking to see if the other | ||
| // json object has the same guid, but _no_ "source" | ||
| if (_Source == WslGeneratorNamespace || | ||
| _Source == AzureGeneratorNamespace || | ||
| _Source == PowershellCoreGeneratorNamespace) | ||
| if (mySource == WslGeneratorNamespace || | ||
| mySource == AzureGeneratorNamespace || | ||
| mySource == PowershellCoreGeneratorNamespace) | ||
| { |
There was a problem hiding this comment.
FYI @carlos-zamora this is the code that makes "source" optional for the pre-0.5 dynamic generators
zadjii-msft
left a comment
There was a problem hiding this comment.
Good work landing all this, it's a complicated change in a complicated codebase, but looks like it should work. I'm sure we'll find out very fast if it doesn't 😄
| void BackgroundImageVerticalAlignment(const Windows::UI::Xaml::VerticalAlignment& value) noexcept; | ||
|
|
||
| GETSET_SETTING(guid, Guid); | ||
| GETSET_SETTING(guid, Guid, _GenerateGuidForProfile(Name(), Source())); |
There was a problem hiding this comment.
I'm shocked that this works, but I get why it does
|
Hello @carlos-zamora! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
|
🎉 Handy links: |
## Summary of the Pull Request This adds `ToJson` functions to `Profile`, `GlobalAppSettings`, and `ColorScheme`. They are used in `CascadiaSettings` to completely serialize an instance of the settings model. Thanks to #7923, all of the settings are `std::optional`, and `JsonUtils` only writes out values that are actually populated. `CascadiaSettings::WriteSettingsToDisk` serializes the current settings and writes them to the settings.json. A backup file is created with your old contents. #### Limitations: - all of the color schemes are serialized regardless of them coming from defaults.json or settings.json - keybindings/actions are copied/pasted ## References #1564 - Settings UI TSM Specs (#6904 and #7876) ## PR Checklist * [x] Tests added/passed
The Settings UI exposes the `profiles.defaults` (PD) object. Today, we remove PD if there's nothing in it. However, that causes problems with the Settings UI, because we have no `Profile` object to bind to (resulting in a crash). Rather than making the Settings UI create a PD, and link it in the inheritance tree, it's much easier to just _always_ create and link the PD object. ## References #1564 - Settings UI (fixes a crash for this) #7923 - Introduces inheritance ## PR Checklist * [X] Tests added/passed ## Validation Steps Performed * [x] repro steps for crash in Settings UI (copied changes over to that branch for testing) * [x] tests passed
Summary of the Pull Request
Introduces
IInheritableas an interface that helps move cascading settings into the Terminal Settings Model.GlobalAppSettingsandProfileboth are nowIInheritable.CascadiaSettingswas updated toCreateChild()for globals and each profile when we are loading the JSON data.IInheritable does most of the heavy lifting. It introduces a two new macros and the interface. The macros help implement the fallback functionality for nullable and non-nullable settings.
References
#7876 - Spec Addendum
#6904 - TSM Spec
#1564 - Settings UI
#7876 -
Copy()needs to be updated to include _parent