2020-10-06 18:56:59 +02:00
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
|
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
|
|
|
|
|
|
|
|
<!-- A note about this project: We're building the test code dll from this
|
|
|
|
|
project, but it _MUST_ be run in conjunction with the TestHostApp project.
|
|
|
|
|
TestHostApp actually will build a TestHost executable and packaging bits
|
|
|
|
|
that we can use to run our tests. We need TestHostApp so that our
|
|
|
|
|
dependencies, like MUX, can be aggregated correctly, and resources properly
|
|
|
|
|
combined into a resources.pri file.
|
|
|
|
|
|
|
|
|
|
TestHostApp will manually copy the output of this project into it's own
|
|
|
|
|
OutDir, so we can run the tests from there. -->
|
|
|
|
|
|
|
|
|
|
<PropertyGroup>
|
|
|
|
|
<ProjectGuid>{CA5CAD1A-9B68-456A-B13E-C8218070DC42}</ProjectGuid>
|
|
|
|
|
<Keyword>Win32Proj</Keyword>
|
|
|
|
|
<RootNamespace>SettingsModelLocalTests</RootNamespace>
|
|
|
|
|
<ProjectName>LocalTests_SettingsModel</ProjectName>
|
|
|
|
|
<TargetName>SettingsModel.LocalTests</TargetName>
|
|
|
|
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
2020-10-27 23:00:41 +01:00
|
|
|
|
<OpenConsoleCppWinRTProject>true</OpenConsoleCppWinRTProject>
|
2020-10-06 18:56:59 +02:00
|
|
|
|
</PropertyGroup>
|
|
|
|
|
|
|
|
|
|
<Import Project="$(SolutionDir)\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
|
|
|
|
|
<Import Project="$(OpenConsoleDir)\src\cppwinrt.build.pre.props" />
|
|
|
|
|
|
|
|
|
|
<!-- ========================= Headers ======================== -->
|
|
|
|
|
<ItemGroup>
|
|
|
|
|
<ClInclude Include="pch.h" />
|
|
|
|
|
<ClInclude Include="JsonTestClass.h" />
|
|
|
|
|
</ItemGroup>
|
|
|
|
|
|
|
|
|
|
<!-- ========================= Cpp Files ======================== -->
|
|
|
|
|
<ItemGroup>
|
|
|
|
|
<ClCompile Include="ProfileTests.cpp" />
|
|
|
|
|
<ClCompile Include="ColorSchemeTests.cpp" />
|
|
|
|
|
<ClCompile Include="KeyBindingsTests.cpp" />
|
|
|
|
|
<ClCompile Include="CommandTests.cpp" />
|
|
|
|
|
<ClCompile Include="DeserializationTests.cpp" />
|
2020-11-17 01:37:19 +01:00
|
|
|
|
<ClCompile Include="SerializationTests.cpp" />
|
2021-03-16 00:15:25 +01:00
|
|
|
|
<ClCompile Include="TerminalSettingsTests.cpp" />
|
2020-10-06 18:56:59 +02:00
|
|
|
|
<ClCompile Include="pch.cpp">
|
|
|
|
|
<PrecompiledHeader>Create</PrecompiledHeader>
|
|
|
|
|
</ClCompile>
|
|
|
|
|
<!-- You _NEED_ to include this file and the jsoncpp IncludePath (below) if
|
|
|
|
|
you want to use jsoncpp -->
|
|
|
|
|
<ClCompile Include="$(OpenConsoleDir)\dep\jsoncpp\jsoncpp.cpp">
|
|
|
|
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
|
|
|
|
</ClCompile>
|
|
|
|
|
</ItemGroup>
|
|
|
|
|
|
|
|
|
|
<!-- ========================= Project References ======================== -->
|
|
|
|
|
<ItemGroup>
|
|
|
|
|
<ProjectReference Include="$(OpenConsoleDir)\src\cascadia\TerminalSettingsModel\Microsoft.Terminal.Settings.ModelLib.vcxproj" />
|
|
|
|
|
<ProjectReference Include="$(OpenConsoleDir)\src\types\lib\types.vcxproj" />
|
2021-04-28 12:43:30 +02:00
|
|
|
|
<ProjectReference Include="$(OpenConsoleDir)src\propslib\propslib.vcxproj" />
|
2020-10-06 18:56:59 +02:00
|
|
|
|
|
|
|
|
|
<!-- If you don't reference these projects here, the
|
|
|
|
|
_ConsoleGenerateAdditionalWinmdManifests step won't gather the winmd's -->
|
2021-03-17 21:47:24 +01:00
|
|
|
|
<ProjectReference Include="$(OpenConsoleDir)src\cascadia\TerminalControl\dll\TerminalControl.vcxproj" />
|
2020-10-06 18:56:59 +02:00
|
|
|
|
<ProjectReference Include="$(OpenConsoleDir)src\cascadia\TerminalConnection\TerminalConnection.vcxproj" />
|
|
|
|
|
<ProjectReference Include="$(OpenConsoleDir)\src\cascadia\TerminalSettingsModel\dll\Microsoft.Terminal.Settings.Model.vcxproj" />
|
|
|
|
|
</ItemGroup>
|
|
|
|
|
|
|
|
|
|
<!-- ========================= Globals ======================== -->
|
|
|
|
|
|
|
|
|
|
<!-- ====================== Compiler & Linker Flags ===================== -->
|
|
|
|
|
<ItemDefinitionGroup>
|
|
|
|
|
<ClCompile>
|
|
|
|
|
<AdditionalIncludeDirectories>..;$(OpenConsoleDir)\dep;$(OpenConsoleDir)\dep\jsoncpp\json;$(OpenConsoleDir)src\inc;$(OpenConsoleDir)src\inc\test;$(WinRT_IncludePath)\..\cppwinrt\winrt;"$(OpenConsoleDir)\src\cascadia\TerminalSettingsModel\Generated Files";%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
|
|
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
|
|
|
|
|
|
|
|
|
<!-- Manually disable unreachable code warning, because jconcpp has a ton of that. -->
|
|
|
|
|
<DisableSpecificWarnings>4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
|
|
|
|
</ClCompile>
|
|
|
|
|
<Link>
|
|
|
|
|
<AdditionalDependencies>onecoreuap.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
Introduce ActionMap to Terminal Settings Model (#9621)
This entirely removes `KeyMapping` from the settings model, and builds on the work done in #9543 to consolidate all actions (key bindings and commands) into a unified data structure (`ActionMap`).
## References
#9428 - Spec
#6900 - Actions page
Closes #7441
## Detailed Description of the Pull Request / Additional comments
The important thing here is to remember that we're shifting our philosophy of how to interact/represent actions. Prior to this, the actions arrays in the JSON would be deserialized twice: once for key bindings, and again for commands. By thinking of every entry in the relevant JSON as a `Command`, we can remove a lot of the context switching between working with a key binding vs a command palette item.
#9543 allows us to make that shift. Given the work in that PR, we can now deserialize all of the relevant information from each JSON action item. This allows us to simplify `ActionMap::FromJson` to simply iterate over each JSON action item, deserialize it, and add it to our `ActionMap`.
Internally, our `ActionMap` operates as discussed in #9428 by maintaining a `_KeyMap` that points to an action ID, and using that action ID to retrieve the `Command` from the `_ActionMap`. Adding actions to the `ActionMap` automatically accounts for name/key-chord collisions. A `NameMap` can be constructed when requested; this is for the Command Palette.
Querying the `ActionMap` is fairly straightforward. Helper functions were needed to be able to distinguish an explicit unbinding vs the command not being found in the current layer. Internally, we store explicitly unbound names/key-chords as `ShortcutAction::Invalid` commands. However, we return `nullptr` when a query points to an unbound command. This is done to hide this complexity away from any caller.
The command palette still needs special handling for nested and iterable commands. Thankfully, the expansion of iterable commands is performed on an `IMapView`, so we can just expose `NameMap` as a consolidation of `ActionMap`'s `NameMap` with its parents. The same can be said for exposing key chords in nested commands.
## Validation Steps Performed
All local tests pass.
2021-05-05 06:50:13 +02:00
|
|
|
|
<!--
|
|
|
|
|
SettingsModelLib contains a DllMain that we need to force the use of.
|
|
|
|
|
If you don't have this, then you'll see an error like
|
|
|
|
|
"(init.obj) : error LNK2005: DllMain already defined in MSVCRTD.lib(dll_dllmain_stub.obj)"
|
|
|
|
|
-->
|
|
|
|
|
<AdditionalOptions Condition="'$(Platform)'=='Win32'">/INCLUDE:_DllMain@12</AdditionalOptions>
|
|
|
|
|
<AdditionalOptions Condition="'$(Platform)'!='Win32'">/INCLUDE:DllMain</AdditionalOptions>
|
2020-10-06 18:56:59 +02:00
|
|
|
|
</Link>
|
|
|
|
|
</ItemDefinitionGroup>
|
|
|
|
|
|
|
|
|
|
<PropertyGroup>
|
|
|
|
|
<GenerateManifest>true</GenerateManifest>
|
|
|
|
|
<EmbedManifest>true</EmbedManifest>
|
|
|
|
|
</PropertyGroup>
|
|
|
|
|
|
|
|
|
|
<!-- Careful reordering these. Some default props (contained in these files) are order sensitive. -->
|
|
|
|
|
<Import Project="$(OpenConsoleDir)src\common.build.post.props" />
|
|
|
|
|
<Import Project="$(OpenConsoleDir)src\common.build.tests.props" />
|
|
|
|
|
|
|
|
|
|
<PropertyGroup>
|
|
|
|
|
<!-- From Microsoft.UI.Xaml.targets -->
|
|
|
|
|
<Native-Platform Condition="'$(Platform)' == 'Win32'">x86</Native-Platform>
|
|
|
|
|
<Native-Platform Condition="'$(Platform)' != 'Win32'">$(Platform)</Native-Platform>
|
2020-12-05 00:49:45 +01:00
|
|
|
|
<_MUXBinRoot>"$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\runtimes\win10-$(Native-Platform)\native\"</_MUXBinRoot>
|
2020-10-06 18:56:59 +02:00
|
|
|
|
</PropertyGroup>
|
|
|
|
|
|
|
|
|
|
<!-- We actually can just straight up reference MUX here, it's fine -->
|
2020-12-05 00:49:45 +01:00
|
|
|
|
<Import Project="..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" />
|
2020-10-06 18:56:59 +02:00
|
|
|
|
|
|
|
|
|
</Project>
|