MCPcopy Create free account
hub / github.com/SpartanJ/eepp / fuzzyMatchTextDocumentSymbol

Function fuzzyMatchTextDocumentSymbol

src/tools/ecode/universallocator.cpp:90–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88};
89
90LSPSymbolInformationList fuzzyMatchTextDocumentSymbol( const LSPSymbolInformationList& list,
91 const std::string& query,
92 const size_t& limit ) {
93 LSPSymbolInformationList nl;
94 std::map<int, LSPSymbolInformation, std::greater<int>> matchesMap;
95
96 for ( const auto& l : list ) {
97 int score = String::fuzzyMatch( query, l.name );
98 if ( score > std::numeric_limits<int>::min() )
99 matchesMap.insert( { score, l } );
100 }
101
102 for ( auto& m : matchesMap ) {
103 m.second.score = m.first;
104 nl.emplace_back( std::move( m.second ) );
105 }
106 return nl;
107}
108
109static constexpr auto LOCATEBAR_MAX_VISIBLE_ITEMS = 18;
110static constexpr auto LOCATEBAR_MAX_RESULTS = 100;

Callers 1

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected