From e86d92d1908a46878a010b8e0e6559003317bb22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Mon, 17 Feb 2025 23:44:01 -0300 Subject: [PATCH] File / path and command fuzzy match improvements. --- src/tools/ecode/commandpalette.cpp | 4 ++-- src/tools/ecode/projectdirectorytree.cpp | 8 ++++---- src/tools/ecode/universallocator.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tools/ecode/commandpalette.cpp b/src/tools/ecode/commandpalette.cpp index ae987d0e4..acd576745 100644 --- a/src/tools/ecode/commandpalette.cpp +++ b/src/tools/ecode/commandpalette.cpp @@ -75,8 +75,8 @@ CommandPalette::fuzzyMatch( const std::vector>& cmdPale std::vector> ret; for ( size_t i = 0; i < cmdPalette.size(); i++ ) { - int matchName = String::fuzzyMatch( cmdPalette[i][0], match ); - int matchKeybind = String::fuzzyMatch( cmdPalette[i][2], match ); + int matchName = String::fuzzyMatch( cmdPalette[i][0], match, true ); + int matchKeybind = String::fuzzyMatch( cmdPalette[i][2], match, true ); matchesMap.insert( { std::max( matchName, matchKeybind ), i } ); } for ( auto& res : matchesMap ) { diff --git a/src/tools/ecode/projectdirectorytree.cpp b/src/tools/ecode/projectdirectorytree.cpp index 389f516cd..2c8300026 100644 --- a/src/tools/ecode/projectdirectorytree.cpp +++ b/src/tools/ecode/projectdirectorytree.cpp @@ -118,8 +118,8 @@ ProjectDirectoryTree::fuzzyMatchTree( const std::vector& matches, c std::vector names; for ( const auto& match : matches ) { for ( size_t i = 0; i < mNames.size(); i++ ) { - int matchName = String::fuzzyMatch( mNames[i], match ); - int matchPath = String::fuzzyMatch( mFiles[i], match ); + int matchName = String::fuzzyMatch( match, mNames[i], true ); + int matchPath = String::fuzzyMatch( match, mFiles[i], true ); matchesMap.insert( { std::max( matchName, matchPath ), i } ); } } @@ -144,8 +144,8 @@ ProjectDirectoryTree::fuzzyMatchTree( const std::string& match, const size_t& ma std::vector files; std::vector names; for ( size_t i = 0; i < mNames.size(); i++ ) { - int matchName = String::fuzzyMatch( mNames[i], match ); - int matchPath = String::fuzzyMatch( mFiles[i], match ); + int matchName = String::fuzzyMatch( match, mNames[i], true ); + int matchPath = String::fuzzyMatch( match, mFiles[i], true ); matchesMap.insert( { std::max( matchName, matchPath ), i } ); } for ( auto& res : matchesMap ) { diff --git a/src/tools/ecode/universallocator.cpp b/src/tools/ecode/universallocator.cpp index 1d258a168..67235470d 100644 --- a/src/tools/ecode/universallocator.cpp +++ b/src/tools/ecode/universallocator.cpp @@ -94,7 +94,7 @@ LSPSymbolInformationList fuzzyMatchTextDocumentSymbol( const LSPSymbolInformatio std::map> matchesMap; for ( const auto& l : list ) { - int matchName = String::fuzzyMatch( l.name, query ); + int matchName = String::fuzzyMatch( l.name, query, true ); matchesMap.insert( { matchName, l } ); }