Files
terminal/src/cascadia/ut_app/TerminalApp.UnitTests.vcxproj
e82eric 74b5a0c975 Update command palette search to prioritize "longest substring" match. (#18700)
It's the fzf algorithm!

Repurposed work from #16586
- I think the fzf algo fits here where it optimizes to find the optimal
  match based on consecutive chars and word boundaries.
- There are some edge cases where a match with a small gap could get a
  higher score than a match of consecutive chars when the match with a
  gap has other bonuses (FirstChar * Boundary Bonus). This can be
  adjusted by adjusting the bonuses or removing them if needed.
- From reading the thread in #6693 it looked like you guys were leaning
  towards something like the fzf algo.
- License file is now updated in
  https://github.com/nvim-telescope/telescope-fzf-native.nvim repository
  - https://github.com/nvim-telescope/telescope-fzf-native.nvim/pull/148
  - https://github.com/junegunn/fzf/issues/4310
- Removed the following from the original implementation to minimize
  complexity and the size of the PR. (Let me know if any of these should
  be added back).
  - Query expressions "$:StartsWith ^:EndsWith |:Or !:Not etc" 
- Slab to avoid allocating the scoring matrix. This felt like overkill
  for the number of items in the command pallete.
- Fallback to V1 algorithm for very long strings. I want to say that the
  command palette won't have strings this long.
- Added the logic from GH#9941 that copies pattern and text chars to
  string for comparision with lstrcmpi
  - It does this twice now which isn't great...

Closes #6693

---------

Co-authored-by: Leonard Hecker <lhecker@microsoft.com>
2025-06-03 00:22:24 +00:00

110 lines
5.4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{CA5CAD1A-9333-4D05-B12A-1905CBF112F9}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>TerminalAppUnitTests</RootNamespace>
<ProjectName>UnitTests_TerminalApp</ProjectName>
<TargetName>Terminal.App.Unit.Tests</TargetName>
<ConfigurationType>DynamicLibrary</ConfigurationType>
<OpenConsoleCppWinRTProject>true</OpenConsoleCppWinRTProject>
</PropertyGroup>
<Import Project="$(SolutionDir)\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
<Import Project="$(OpenConsoleDir)\src\common.build.pre.props" />
<Import Project="$(SolutionDir)\src\common.nugetversions.props" />
<!-- ========================= Headers ======================== -->
<ItemGroup>
<ClInclude Include="precomp.h" />
</ItemGroup>
<!-- ========================= Cpp Files ======================== -->
<ItemGroup>
<ClCompile Include="ColorHelperTests.cpp" />
<ClCompile Include="JsonUtilsTests.cpp" />
<ClCompile Include="FzfTests.cpp" />
<ClCompile Include="precomp.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\TerminalApp\ColorHelper.cpp">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<!-- ========================= Project References ======================== -->
<ItemGroup>
<ProjectReference Include="$(OpenConsoleDir)\src\cascadia\TerminalApp\TerminalAppLib.vcxproj" />
<ProjectReference Include="$(OpenConsoleDir)\src\cascadia\TerminalSettingsModel\Microsoft.Terminal.Settings.ModelLib.vcxproj" />
<ProjectReference Include="$(OpenConsoleDir)\src\types\lib\types.vcxproj" />
<ProjectReference Include="$(OpenConsoleDir)src\propslib\propslib.vcxproj" />
</ItemGroup>
<!-- ========================= Globals ======================== -->
<!-- ====================== Compiler & Linker Flags ===================== -->
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>..;$(OpenConsoleDir)src\cascadia\inc;$(OpenConsoleDir)src\inc;$(OpenConsoleDir)src\inc\test;$(WinRT_IncludePath)\..\cppwinrt\winrt;"$(OpenConsoleDir)\src\cascadia\TerminalApp\Generated Files";"$(OpenConsoleDir)\src\cascadia\TerminalSettingsModel\Generated Files";%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>precomp.h</PrecompiledHeaderFile>
<!-- Manually disable unreachable code warning, because jconcpp has a ton of that. -->
<DisableSpecificWarnings>4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>WindowsApp.lib;%(AdditionalDependencies)</AdditionalDependencies>
<!--
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'">%(AdditionalOptions) /INCLUDE:_DllMain@12</AdditionalOptions>
<AdditionalOptions Condition="'$(Platform)'!='Win32'">%(AdditionalOptions) /INCLUDE:DllMain</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<PropertyGroup>
<GenerateManifest>true</GenerateManifest>
<EmbedManifest>true</EmbedManifest>
</PropertyGroup>
<ItemGroup>
<Manifest Include="TerminalApp.Unit.Tests.manifest" />
</ItemGroup>
<!-- 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" />
<Import Project="$(SolutionDir)src\common.nugetversions.targets" />
<ItemDefinitionGroup>
<PreBuildEvent>
<!-- Manually copy the Windows Terminal manifest to our project directory,
so we only need to have one version for the entire solution. -->
<Command>
(xcopy /Y &quot;$(OpenConsoleDir)src\cascadia\WindowsTerminal\WindowsTerminal.manifest&quot; &quot;$(OpenConsoleDir)src\cascadia\ut_app\TerminalApp.Unit.Tests.manifest*&quot; )
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup>
<PostBuildEvent>
<!-- Manually copy A few needed things to our outdir.
1. Our manifest, because some tests that can run unpackaged will need that
to activate winrt types.
2. Our AppManifest, for tests that _can't_ run unpackaged. Taef will use
this during execution to create a temp package to run the tests in.
3. All our dependent dlls, for any cppwinrt projects we have. We'll need
them adjacent if we hope to activate any types contained in them. This
also includes MUX manually, as the MUX targets from the nuget package
don't work on this project :/
-->
<Command>
echo OutDir=$(OutDir)
(xcopy /Y &quot;$(OpenConsoleDir)src\cascadia\ut_app\TerminalApp.Unit.Tests.manifest&quot; &quot;$(OutDir)\TerminalApp.Unit.Tests.manifest*&quot; )
(xcopy /Y &quot;$(OpenConsoleDir)src\cascadia\ut_app\TerminalApp.Unit.Tests.AppxManifest.xml&quot; &quot;$(OutDir)\TerminalApp.Unit.Tests.AppxManifest.xml*&quot; )
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
</Project>