Skip to content

Commit

Permalink
File / path and command fuzzy match improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
SpartanJ committed Feb 18, 2025
1 parent 47c8aa0 commit e86d92d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/tools/ecode/commandpalette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
8 changes: 4 additions & 4 deletions src/tools/ecode/projectdirectorytree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 } );
}
}
Expand All @@ -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 ) {
Expand Down
2 changes: 1 addition & 1 deletion src/tools/ecode/universallocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 } );
}

Expand Down

0 comments on commit e86d92d

Please sign in to comment.