- enhancement: improve code completion for std iterators defined with "using namespace std"

This commit is contained in:
Roy Qu 2023-06-20 21:07:26 +08:00
parent 3cc00eaf8f
commit 35b986a358
2 changed files with 7 additions and 8 deletions

View File

@ -7,6 +7,9 @@ Red Panda C++ Version 2.23
- fix: Goto definition/Goto declaration/Info tips can't be correctly triggered when mouse pointer is at the last half character of current word. - fix: Goto definition/Goto declaration/Info tips can't be correctly triggered when mouse pointer is at the last half character of current word.
- fix: Use "/" as path seperator when starting app by double clicking c/c++ files in the explorer. - fix: Use "/" as path seperator when starting app by double clicking c/c++ files in the explorer.
- enhancement: differenciate -> and . when displaying completion suggestion infos. - enhancement: differenciate -> and . when displaying completion suggestion infos.
- enhancement: improve code completion for std iterators defined with "using namespace std"
- enhancement: improve pointer calculation when inferencing type info
- enhancement: improve parsing for multiple vars defined in one line
Red Panda C++ Version 2.22 Red Panda C++ Version 2.22

View File

@ -756,8 +756,8 @@ QSet<QString> CppParser::internalGetFileUsings(const QString &filename) const
QSet<QString> result; QSet<QString> result;
if (filename.isEmpty()) if (filename.isEmpty())
return result; return result;
if (mParsing) // if (mParsing)
return result; // return result;
PFileIncludes fileIncludes= mPreprocessor.includesList().value(filename,PFileIncludes()); PFileIncludes fileIncludes= mPreprocessor.includesList().value(filename,PFileIncludes());
if (fileIncludes) { if (fileIncludes) {
foreach (const QString& usingName, fileIncludes->usings) { foreach (const QString& usingName, fileIncludes->usings) {
@ -3817,7 +3817,7 @@ void CppParser::handleVar(const QString& typePrefix,bool isExtern,bool isStatic)
return; return;
case '=': case '=':
if (mIndex+1<tokenCount if (mIndex+1<tokenCount
&& isIdentifier(mTokenizer[mIndex+1]->text) && mTokenizer[mIndex+1]->text!="{"
&& addedVar && addedVar
&& !(addedVar->properties & StatementProperty::spFunctionPointer) && !(addedVar->properties & StatementProperty::spFunctionPointer)
&& AutoTypes.contains(addedVar->type)) { && AutoTypes.contains(addedVar->type)) {
@ -3963,7 +3963,7 @@ void CppParser::handleVar(const QString& typePrefix,bool isExtern,bool isStatic)
} }
} }
} else } else
addedVar->type = aliasStatement->baseType + aliasStatement->templateParams; addedVar->type = aliasStatement->baseType + aliasStatement->templateParams;
if (aliasStatement->pointerLevel>0) if (aliasStatement->pointerLevel>0)
addedVar->type += QString(aliasStatement->pointerLevel,'*'); addedVar->type += QString(aliasStatement->pointerLevel,'*');
} }
@ -5312,8 +5312,6 @@ PStatement CppParser::doParseEvalTypeInfo(
if (bracketLevel == 0 && templateLevel ==0) { if (bracketLevel == 0 && templateLevel ==0) {
if (token == "*") if (token == "*")
pointerLevel++; pointerLevel++;
else if (token == "&")
pointerLevel--;
else if (syntaxer.getTokenAttribute()->tokenType() == QSynedit::TokenType::Identifier) { else if (syntaxer.getTokenAttribute()->tokenType() == QSynedit::TokenType::Identifier) {
baseType += token; baseType += token;
} else if (token == "[") { } else if (token == "[") {
@ -5367,8 +5365,6 @@ PStatement CppParser::doParseEvalTypeInfo(
if (bracketLevel == 0 && templateLevel ==0) { if (bracketLevel == 0 && templateLevel ==0) {
if (token == "*") if (token == "*")
pointerLevel++; pointerLevel++;
else if (token == "&")
pointerLevel--;
else if (syntaxer.getTokenAttribute()->tokenType() == QSynedit::TokenType::Identifier) { else if (syntaxer.getTokenAttribute()->tokenType() == QSynedit::TokenType::Identifier) {
baseType += token; baseType += token;
} else if (token == "[") { } else if (token == "[") {