Commit 89ae7bcb authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Don't trigger completion always

Introduces a new variable m_triggerCompletion that is true only if we
should trigger completion.

Previously we were triggering completion even if only signature help
was possible which lead to annoying ux.
parent 753f8b5f
Pipeline #256390 passed with stage
in 7 minutes and 26 seconds
......@@ -195,6 +195,7 @@ class LSPClientCompletionImpl : public LSPClientCompletion
QVector<QChar> m_triggersCompletion;
QVector<QChar> m_triggersSignature;
bool m_triggerSignature = false;
bool m_triggerCompletion = false;
QList<LSPClientCompletionItem> m_matches;
LSPClientServer::RequestHandle m_handle, m_handleSig;
......@@ -311,11 +312,11 @@ public:
m_triggerSignature = false;
complete = complete || m_triggersCompletion.contains(lastChar);
m_triggerCompletion = complete;
if (m_triggersSignature.contains(lastChar)) {
complete = true;
m_triggerSignature = true;
}
return complete;
}
......@@ -396,7 +397,9 @@ public:
auto cursor = qMax(range.start(), qMin(range.end(), position));
m_manager->update(document, false);
m_handle = m_server->documentCompletion(document->url(), {cursor.line(), cursor.column()}, this, handler);
if (m_triggerCompletion) {
m_handle = m_server->documentCompletion(document->url(), {cursor.line(), cursor.column()}, this, handler);
}
if (m_signatureHelp && m_triggerSignature) {
m_handleSig = m_server->signatureHelp(document->url(), {cursor.line(), cursor.column()}, this, sigHandler);
......
Supports Markdown
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