mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-16 22:15:01 +03:00
ecode: Improved auto-completion suggestions. Fixed not being able to comment a single line with ctrl + /.
This commit is contained in:
@@ -45,7 +45,9 @@ fuzzyMatchSymbols( const std::vector<const AutoCompletePlugin::SymbolsList*>& sy
|
||||
int score;
|
||||
for ( const auto& symbols : symbolsVec ) {
|
||||
for ( const auto& symbol : *symbols ) {
|
||||
if ( ( score = String::fuzzyMatch( symbol.text, match ) ) > 0 ) {
|
||||
if ( ( score = String::fuzzyMatch( symbol.text, match, false,
|
||||
symbol.kind != LSPCompletionItemKind::Text ) ) >
|
||||
0 ) {
|
||||
if ( std::find( matches.begin(), matches.end(), symbol ) == matches.end() ) {
|
||||
symbol.setScore( score );
|
||||
matches.push_back( symbol );
|
||||
@@ -496,6 +498,13 @@ AutoCompletePlugin::processCodeCompletion( const LSPCompletionList& completion )
|
||||
fuzzySuggestions = fuzzyMatchSymbols( { &suggestions, &symbols }, symbol,
|
||||
eemax<size_t>( 100UL, suggestions.size() ) );
|
||||
}
|
||||
|
||||
if ( fuzzySuggestions.empty() && !suggestions.empty() ) {
|
||||
for ( const auto& suggestion : suggestions )
|
||||
if ( String::startsWith( suggestion.text, symbol ) )
|
||||
fuzzySuggestions.emplace_back( std::move( suggestion ) );
|
||||
}
|
||||
|
||||
Lock l( mSuggestionsMutex );
|
||||
mSuggestions = fuzzySuggestions;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user