From 8a2d40f6d74292cfabb69c18381a85f981fcd1bc Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sat, 4 Dec 2021 14:53:21 +0800 Subject: [PATCH] minor refactor --- RedPandaIDE/widgets/codecompletionpopup.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/RedPandaIDE/widgets/codecompletionpopup.cpp b/RedPandaIDE/widgets/codecompletionpopup.cpp index 01ce994e..b74e7f29 100644 --- a/RedPandaIDE/widgets/codecompletionpopup.cpp +++ b/RedPandaIDE/widgets/codecompletionpopup.cpp @@ -79,17 +79,17 @@ void CodeCompletionPopup::prepareSearch( mIncludedFiles = mParser->getFileIncludes(filename); getCompletionFor(ownerExpression,memberOperator,memberExpression, filename,line); } else { - getFullCompletionListFor(preWord); + getCompletionListForPreWord(preWord); } setCursor(oldCursor); } -bool CodeCompletionPopup::search(const QString &phrase, bool autoHideOnSingleResult) +bool CodeCompletionPopup::search(const QString &memberPhrase, bool autoHideOnSingleResult) { QMutexLocker locker(&mMutex); - mMemberPhrase = phrase; + mMemberPhrase = memberPhrase; if (!isEnabled()) { hide(); @@ -99,9 +99,8 @@ bool CodeCompletionPopup::search(const QString &phrase, bool autoHideOnSingleRes QCursor oldCursor = cursor(); setCursor(Qt::CursorShape::WaitCursor); - QString symbol = phrase; // filter fFullCompletionStatementList to fCompletionStatementList - filterList(symbol); + filterList(memberPhrase); //if can't find a destructor, maybe '~' is only an operator // if (mCompletionStatementList.isEmpty() && phrase.startsWith('~')) { @@ -118,7 +117,7 @@ bool CodeCompletionPopup::search(const QString &phrase, bool autoHideOnSingleRes // if only one suggestion and auto hide , don't show the frame if(mCompletionStatementList.count() == 1) if (autoHideOnSingleResult - || (symbol == mCompletionStatementList.front()->command)) { + || (memberPhrase == mCompletionStatementList.front()->command)) { return true; } } else { @@ -552,9 +551,9 @@ void CodeCompletionPopup::getCompletionFor( scopeName, mCurrentStatement, parentTypeStatement); - qDebug()<