Deprioritize completion items with additionTextEdits

This commit is contained in:
Fangrui Song 2018-10-23 10:09:32 -07:00
parent dc20ea3b33
commit 4f8889c195

View File

@ -215,6 +215,10 @@ void FilterCandidates(lsCompletionList &result,
items.end()); items.end());
std::sort(items.begin(), items.end(), std::sort(items.begin(), items.end(),
[](const lsCompletionItem &lhs, const lsCompletionItem &rhs) { [](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_) if (lhs.score_ != rhs.score_)
return lhs.score_ > rhs.score_; return lhs.score_ > rhs.score_;
if (lhs.priority_ != rhs.priority_) if (lhs.priority_ != rhs.priority_)