From 16c2e0643b259d891a420f23de9e0353edf37f1e Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Tue, 23 Oct 2018 10:09:32 -0700 Subject: [PATCH] Deprioritize completion items with additionTextEdits --- src/messages/textDocument_completion.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/messages/textDocument_completion.cc b/src/messages/textDocument_completion.cc index e5a62523..4e83cc8f 100644 --- a/src/messages/textDocument_completion.cc +++ b/src/messages/textDocument_completion.cc @@ -227,6 +227,10 @@ void FilterCandidates(lsCompletionList &result, items.end()); std::sort(items.begin(), items.end(), [](const lsCompletionItem &lhs, const lsCompletionItem &rhs) { + int t = int(lhs.additionalTextEdits.size() - + rhs.additionalTextEdits.size()); + if (t) + return t < 0; if (lhs.score_ != rhs.score_) return lhs.score_ > rhs.score_; if (lhs.priority_ != rhs.priority_)