aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2020-09-09 12:37:44 +0200
committerChristian Stenger <christian.stenger@qt.io>2020-09-09 10:44:05 +0000
commit24f35037d19ff1560823c02bef7fa222784aa94e (patch)
treedfee67d6e8f80b78f4c3b2d5876fc084eed6c44a
parentf7634fc73836e368cfa14379eeda26ee761b16b7 (diff)
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 <david.schulz@qt.io>
-rw-r--r--src/plugins/languageclient/languageclientcompletionassist.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/languageclient/languageclientcompletionassist.cpp b/src/plugins/languageclient/languageclientcompletionassist.cpp
index 0b38b42edc..db6e2dc2bf 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 = [&regexp](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)))