Always include literal completions

This commit is contained in:
Jacob Dufault 2017-06-28 21:33:52 -07:00
parent 706479aded
commit 25d450cf8b

View File

@ -473,6 +473,16 @@ void FilterCompletionResponse(Out_TextDocumentComplete* complete_response,
else { else {
NonElidedVector<lsCompletionItem> filtered_result; NonElidedVector<lsCompletionItem> filtered_result;
filtered_result.reserve(kMaxResultSize); filtered_result.reserve(kMaxResultSize);
for (const lsCompletionItem& item : complete_response->result.items) {
if (item.label.find(complete_text) != std::string::npos) {
filtered_result.push_back(item);
if (filtered_result.size() >= kMaxResultSize)
break;
}
}
if (filtered_result.size() < kMaxResultSize) {
for (const lsCompletionItem& item : complete_response->result.items) { for (const lsCompletionItem& item : complete_response->result.items) {
if (SubstringMatch(complete_text, item.label)) { if (SubstringMatch(complete_text, item.label)) {
//std::cerr << "!! emitting " << item.label << std::endl; //std::cerr << "!! emitting " << item.label << std::endl;
@ -481,6 +491,7 @@ void FilterCompletionResponse(Out_TextDocumentComplete* complete_response,
break; break;
} }
} }
}
complete_response->result.items = filtered_result; complete_response->result.items = filtered_result;
} }