forked from qt-creator/qt-creator
LanguageClient: Replace QRegexp by QRegularExpression
Task-number: QTCREATORBUG-24098 Change-Id: Ic8259ded3f721957bd04aa00146b20bd90b41dcd Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -40,7 +40,6 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QLoggingCategory>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QTextBlock>
|
||||
#include <QTextDocument>
|
||||
@@ -309,9 +308,10 @@ 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 QRegExp 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 && regexp.exactMatch(interface->textAt(m_pos - delta - 1, delta + 1)))
|
||||
while (m_pos - delta > 0 && hasMatch(interface->textAt(m_pos - delta - 1, delta + 1)))
|
||||
++delta;
|
||||
if (delta < 3)
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user