From 25d450cf8bf7ff1ddddaee63e00f2003b75ef6bc Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Wed, 28 Jun 2017 21:33:52 -0700 Subject: [PATCH] Always include literal completions --- src/command_line.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/command_line.cc b/src/command_line.cc index c6513caa..9d0a2389 100644 --- a/src/command_line.cc +++ b/src/command_line.cc @@ -473,15 +473,26 @@ void FilterCompletionResponse(Out_TextDocumentComplete* complete_response, else { NonElidedVector filtered_result; filtered_result.reserve(kMaxResultSize); + for (const lsCompletionItem& item : complete_response->result.items) { - if (SubstringMatch(complete_text, item.label)) { - //std::cerr << "!! emitting " << item.label << std::endl; + 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) { + if (SubstringMatch(complete_text, item.label)) { + //std::cerr << "!! emitting " << item.label << std::endl; + filtered_result.push_back(item); + if (filtered_result.size() >= kMaxResultSize) + break; + } + } + } + complete_response->result.items = filtered_result; }