Commit 553dede8 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Fix duplicates in completion causing wrong item to be executed

parent d204bade
......@@ -271,6 +271,13 @@ public:
auto handler = [this](const QList<LSPCompletionItem> & compl ) {
beginResetModel();
qCInfo(LSPCLIENT) << "adding completions " << compl .size();
// purge all existing completion items
m_matches.erase(std::remove_if(m_matches.begin(),
m_matches.end(),
[](const LSPClientCompletionItem &ci) {
return ci.argumentHintDepth == 0;
}),
m_matches.end());
for (const auto &item : compl ) {
m_matches.push_back(item);
}
......@@ -283,6 +290,12 @@ public:
beginResetModel();
qCInfo(LSPCLIENT) << "adding signatures " << sig.signatures.size();
int index = 0;
m_matches.erase(std::remove_if(m_matches.begin(),
m_matches.end(),
[](const LSPClientCompletionItem &ci) {
return ci.argumentHintDepth == 1;
}),
m_matches.end());
for (const auto &item : sig.signatures) {
int sortIndex = 10 + index;
int active = -1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment