terminal/src/inc
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
..
CppCoreCheck Fix a bunch of spelling errors across the project (#4295) 2020-02-10 20:40:01 +00:00
test ROW: clean up in preparation to hide CharRow & AttrRow (#8446) 2021-01-20 21:16:56 +00:00
til Reduce usage of Json::Value throughout Terminal.Settings.Model (#11184) 2021-09-22 16:27:31 +00:00
argb.h add clang-format conf to the project, format the c++ code (#1141) 2019-06-11 13:27:09 -07:00
conattrs.hpp Prefer constexpr over const across the codebase (#9587) 2021-03-29 16:03:16 +00:00
conime.h Replace basic_string_view<T> with span<const T> (#6921) 2020-07-15 16:40:42 +00:00
conint.h Merged PR 5677497: [Git2Git] Merged PR 5655213: Allow conhost to handoff to registered default app handler 2021-02-11 21:07:50 +00:00
conpty-static.h Implement and action for manually clearing the Terminal (and conpty) buffer (#10906) 2021-09-02 14:59:42 +00:00
conpty.h Implement and action for manually clearing the Terminal (and conpty) buffer (#10906) 2021-09-02 14:59:42 +00:00
consoletaeftemplates.hpp Enable /Zc:preprocessor (#10593) 2021-07-13 23:00:11 +00:00
contsf.h add clang-format conf to the project, format the c++ code (#1141) 2019-06-11 13:27:09 -07:00
cpl_core.h Fix a bunch of spelling errors across the project (#4295) 2020-02-10 20:40:01 +00:00
DefaultSettings.h Reduce usage of Json::Value throughout Terminal.Settings.Model (#11184) 2021-09-22 16:27:31 +00:00
HostAndPropsheetIncludes.h Introduce UiaTextRangeBase::FindText() for Accessibility (#4373) 2020-01-31 23:26:19 +00:00
HostSignals.hpp Persist inbox conhost; delegate control activities to it via a pipe (#10415) 2021-06-16 19:23:37 +00:00
ITerminalOutputConnection.hpp Apply audit mode to TerminalInput/Adapter/Parser libraries (#4005) 2020-01-03 14:25:21 +00:00
ITerminalOwner.hpp Revert locking changes (#3488) 2019-11-08 13:44:52 -08:00
LibraryIncludes.h Persist inbox conhost; delegate control activities to it via a pipe (#10415) 2021-06-16 19:23:37 +00:00
operators.hpp Initial release of the Windows Terminal source code 2019-05-02 15:29:04 -07:00
til.h Make the TerminalApi exception handler less garrulous (#10901) 2021-08-09 18:28:06 +00:00
unicode.hpp Prefer constexpr over const across the codebase (#9587) 2021-03-29 16:03:16 +00:00
VtIoModes.hpp Remove the WinTelnetEngine (#6526) 2020-06-17 16:29:49 +00:00
WilErrorReporting.h Enable /Zc:preprocessor (#10593) 2021-07-13 23:00:11 +00:00
winrtTaefTemplates.hpp A bunch of test fixes (#9192) 2021-02-18 20:47:14 +00:00