From 24f35037d19ff1560823c02bef7fa222784aa94e Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 9 Sep 2020 12:37:44 +0200 Subject: [PATCH] LanguageClient: Fix regular expression The match has to be a full match to avoid always validating the full file if located at a literal. This fixes bad performance of language clients in big files. Amends 119a3c1ce9942. Change-Id: I7153f3d7d7125715846de7626d215093feae2908 Reviewed-by: David Schulz --- src/plugins/languageclient/languageclientcompletionassist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/languageclient/languageclientcompletionassist.cpp b/src/plugins/languageclient/languageclientcompletionassist.cpp index 0b38b42edc9..db6e2dc2bff 100644 --- a/src/plugins/languageclient/languageclientcompletionassist.cpp +++ b/src/plugins/languageclient/languageclientcompletionassist.cpp @@ -315,7 +315,7 @@ IAssistProposal *LanguageClientCompletionAssistProcessor::perform(const AssistIn m_pos = interface->position(); if (interface->reason() == IdleEditor) { // Trigger an automatic completion request only when we are on a word with more than 2 "identifier" character - const QRegularExpression regexp("[_a-zA-Z0-9]+"); + const QRegularExpression regexp("^[_a-zA-Z0-9]+$"); auto hasMatch = [®exp](const QString &txt) { return regexp.match(txt).hasMatch(); }; int delta = 0; while (m_pos - delta > 0 && hasMatch(interface->textAt(m_pos - delta - 1, delta + 1)))