terminal/src
Leonard Hecker 168d28b036
Reduce usage of Json::Value throughout Terminal.Settings.Model (#11184)
This commit reduces the code surface that interacts with raw JSON data,
reducing code complexity and improving maintainability.
Files that needed to be changed drastically were additionally
cleaned up to remove any code cruft that has accrued over time.

In order to facility this the following changes were made:
* Move JSON handling from `CascadiaSettings` into `SettingsLoader`
  This allows us to use STL containers for data model instances.
  For instance profiles are now added to a hashmap for O(1) lookup.
* JSON parsing within `SettingsLoader` doesn't differentiate between user,
  inbox and fragment JSON data, reducing code complexity and size.
  It also centralizes common concerns, like profile deduplication and
  ensuring that all profiles are assigned a GUID.
* Direct JSON modification, like the insertion of dynamic profiles into
  settings.json were removed. This vastly reduces code complexity,
  but unfortunately removes support for comments in JSON on first start.
* `ColorScheme`s cannot be layered. As such its `LayerJson` API was replaced
  with `FromJson`, allowing us to remove JSON-based color scheme validation.
* `Profile`s used to test their wish to layer using `ShouldBeLayered`, which
  was replaced with a GUID-based hashmap lookup on previously parsed profiles.

Further changes were made as improvements upon the previous changes:
* Compact the JSON files embedded binary, saving 28kB
* Prevent double-initialization of the color table in `ColorScheme`
* Making `til::color` getters `constexpr`, allow better optimizations

The result is a reduction of:
* 48kB binary size for the Settings.Model.dll
* 5-10% startup duration
* 26% code for the `CascadiaSettings` class
* 1% overall code in this project

Furthermore this results in the following breaking changes:
* The long deprecated "globals" settings object will not be detected and no
  warning will be created during load.
* The initial creation of a new settings.json will not produce helpful comments.

Both cases are caused by the removal of manual JSON handling and the
move to representing the settings file with model objects instead

## PR Checklist
* [x] Closes #5276
* [x] Closes #7421
* [x] I work here
* [x] Tests added/passed

## Validation Steps Performed

* Out-of-box-experience is identical to before ✔️
  (Except for the settings.json file lacking comments.)
* Existing user settings load correctly ✔️
* New WSL instances are added to user settings ✔️
* New fragments are added to user settings ✔️
* All profiles are assigned GUIDs ✔️
2021-09-22 16:27:31 +00:00
..
api-ms-win-core-synch-l1-2-0 Introduce a api-ms-win-core-synch-l1-2-0 shim for Windows 7 (#10559) 2021-07-07 16:48:28 +00:00
buffer [A11y] Treat last character as 'end of buffer' (#11122) 2021-09-16 20:44:29 +00:00
cascadia Reduce usage of Json::Value throughout Terminal.Settings.Model (#11184) 2021-09-22 16:27:31 +00:00
dep Move all wildcards into targets or expand them (#6406) 2020-06-08 14:01:47 -07:00
host Implement and action for manually clearing the Terminal (and conpty) buffer (#10906) 2021-09-02 14:59:42 +00:00
inc Reduce usage of Json::Value throughout Terminal.Settings.Model (#11184) 2021-09-22 16:27:31 +00:00
interactivity [A11y] Treat last character as 'end of buffer' (#11122) 2021-09-16 20:44:29 +00:00
internal Implement Default Terminal (#7489) 2021-03-26 17:09:49 -05:00
propsheet Merged PR 6176782: [Git2Git] Get rid of dead build macros/#defines FE_IME, W32_SB, etc. 2021-06-21 10:50:52 -07:00
propslib Merged PR 6176782: [Git2Git] Get rid of dead build macros/#defines FE_IME, W32_SB, etc. 2021-06-21 10:50:52 -07:00
renderer Fix setting wght axis font bugs (#10863) 2021-08-25 01:19:40 +00:00
server Release unneeded memory more eagerly from conhost (#10738) 2021-07-21 05:59:57 +00:00
staging Merged PR 6147892: Make til::feature build in the OS 2021-06-11 17:57:36 +00:00
terminal Add basic support for the DECRQSS settings query (#11152) 2021-09-08 23:26:44 +00:00
testlist Reflect testlist change from OS 2021-03-29 15:24:43 -05:00
til Introduce vk() and sc() key chord specifiers (#10666) 2021-07-20 22:34:51 +00:00
tools Remove time and sys (#11100) 2021-09-01 21:30:39 +00:00
tsf Merged PR 6176782: [Git2Git] Get rid of dead build macros/#defines FE_IME, W32_SB, etc. 2021-06-21 10:50:52 -07:00
types Reduce usage of Json::Value throughout Terminal.Settings.Model (#11184) 2021-09-22 16:27:31 +00:00
winconpty Implement and action for manually clearing the Terminal (and conpty) buffer (#10906) 2021-09-02 14:59:42 +00:00
common.build.post.props Add support for branch- and branding-based feature flagging (#10361) 2021-06-10 23:09:52 +00:00
common.build.pre.props Adjust tools version for folks running on 2022 (#11266) 2021-09-17 20:58:08 +00:00
common.build.tests.props Enable /Zc:preprocessor (#10593) 2021-07-13 23:00:11 +00:00
common.pgo.compile.props Implement PGO in pipelines for AMD64 architecture; supply training test scenarios (#10071) 2021-05-13 21:12:30 +00:00
common.pgo.runtime.props Implement PGO in pipelines for AMD64 architecture; supply training test scenarios (#10071) 2021-05-13 21:12:30 +00:00
ConsolePerf.regions.xml
ConsolePerf.wprp Set keyword flags on all tracelog events (#10098) 2021-05-14 23:14:26 +00:00
cppwinrt.build.post.props Upgrade to C++/WinRT 2.0.210825.3 (#11188) 2021-09-10 21:33:13 +00:00
cppwinrt.build.pre.props Upgrade to C++/WinRT 2.0.210825.3 (#11188) 2021-09-10 21:33:13 +00:00
dirs Merged PR 6147892: Make til::feature build in the OS 2021-06-11 17:57:36 +00:00
features.xml Replace TrayIcon with NotificationIcon (#11219) 2021-09-14 16:12:40 +00:00
project.inc Merged PR 6147892: Make til::feature build in the OS 2021-06-11 17:57:36 +00:00
project.unittest.inc Merged PR 4915530: Reflect OS Build fixes on top of 58f5d7c7 2020-07-13 23:00:53 +00:00
StaticAnalysis.ruleset Fix SA for Visual Studio 16.8 (#8551) 2020-12-11 05:04:30 +00:00
Terminal.wprp Set keyword flags on all tracelog events (#10098) 2021-05-14 23:14:26 +00:00
unit.tests.x64.runsettings
unit.tests.x86.runsettings
wap-common.build.post.props
wap-common.build.pre.props Fix compilation with VS16.10 and later (#10208) 2021-05-26 20:11:38 +00:00