Always do completion on manual trigger.

This commit is contained in:
rianneogi 2018-01-10 23:47:33 +05:30 committed by Jacob Dufault
parent a324178fcb
commit 2f8d11e5ff

View File

@ -298,12 +298,11 @@ struct TextDocumentCompletionHandler : MessageHandler {
[this, is_global_completion, existing_completion, request]( [this, is_global_completion, existing_completion, request](
const std::vector<lsCompletionItem>& results, const std::vector<lsCompletionItem>& results,
bool is_cached_result) { bool is_cached_result) {
Out_TextDocumentComplete out; //If existing completion is empty, dont return completion results
out.id = request->id; //Only do this when trigger is not manual and context doesn't exist
out.result.items = results; //(for Atom support)
if (existing_completion.empty() && is_global_completion && !(request->params.context) &&
// Emit completion results. request->params.context->triggerKind == lsCompletionTriggerKind::TriggerCharacter) {
if (existing_completion.empty() && is_global_completion) {
LOG_S(INFO) << "Existing completion is empty, no completion results will be returned"; LOG_S(INFO) << "Existing completion is empty, no completion results will be returned";
Out_TextDocumentComplete out; Out_TextDocumentComplete out;
out.id = request->id; out.id = request->id;
@ -311,6 +310,11 @@ struct TextDocumentCompletionHandler : MessageHandler {
return; return;
} }
Out_TextDocumentComplete out;
out.id = request->id;
out.result.items = results;
// Emit completion results.
SortAndFilterCompletionResponse(&out, existing_completion); SortAndFilterCompletionResponse(&out, existing_completion);
QueueManager::WriteStdout(IpcId::TextDocumentCompletion, out); QueueManager::WriteStdout(IpcId::TextDocumentCompletion, out);