File / path and command fuzzy match improvements.

This commit is contained in:
Martín Lucas Golini
2025-02-17 23:44:01 -03:00
parent 47c8aa0774
commit e86d92d190
3 changed files with 7 additions and 7 deletions

View File

@@ -75,8 +75,8 @@ CommandPalette::fuzzyMatch( const std::vector<std::vector<std::string>>& cmdPale
std::vector<std::vector<std::string>> 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 ) {

View File

@@ -118,8 +118,8 @@ ProjectDirectoryTree::fuzzyMatchTree( const std::vector<std::string>& matches, c
std::vector<std::string> 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<std::string> files;
std::vector<std::string> 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 ) {

View File

@@ -94,7 +94,7 @@ LSPSymbolInformationList fuzzyMatchTextDocumentSymbol( const LSPSymbolInformatio
std::map<int, LSPSymbolInformation, std::greater<int>> 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 } );
}