forked from qt-creator/qt-creator
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 119a3c1ce9.
Change-Id: I7153f3d7d7125715846de7626d215093feae2908
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user