From 35b986a3584d96dca75aaf7b518dbc55f10730ea Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Tue, 20 Jun 2023 21:07:26 +0800 Subject: [PATCH] - enhancement: improve code completion for std iterators defined with "using namespace std" --- NEWS.md | 3 +++ RedPandaIDE/parser/cppparser.cpp | 12 ++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/NEWS.md b/NEWS.md index 1959e0a8..bfbd0cf3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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: 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: 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 diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index edc87632..7890ea6b 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -756,8 +756,8 @@ QSet CppParser::internalGetFileUsings(const QString &filename) const QSet result; if (filename.isEmpty()) return result; - if (mParsing) - return result; +// if (mParsing) +// return result; PFileIncludes fileIncludes= mPreprocessor.includesList().value(filename,PFileIncludes()); if (fileIncludes) { foreach (const QString& usingName, fileIncludes->usings) { @@ -3817,7 +3817,7 @@ void CppParser::handleVar(const QString& typePrefix,bool isExtern,bool isStatic) return; case '=': if (mIndex+1text) + && mTokenizer[mIndex+1]->text!="{" && addedVar && !(addedVar->properties & StatementProperty::spFunctionPointer) && AutoTypes.contains(addedVar->type)) { @@ -3963,7 +3963,7 @@ void CppParser::handleVar(const QString& typePrefix,bool isExtern,bool isStatic) } } } else - addedVar->type = aliasStatement->baseType + aliasStatement->templateParams; + addedVar->type = aliasStatement->baseType + aliasStatement->templateParams; if (aliasStatement->pointerLevel>0) addedVar->type += QString(aliasStatement->pointerLevel,'*'); } @@ -5312,8 +5312,6 @@ PStatement CppParser::doParseEvalTypeInfo( if (bracketLevel == 0 && templateLevel ==0) { if (token == "*") pointerLevel++; - else if (token == "&") - pointerLevel--; else if (syntaxer.getTokenAttribute()->tokenType() == QSynedit::TokenType::Identifier) { baseType += token; } else if (token == "[") { @@ -5367,8 +5365,6 @@ PStatement CppParser::doParseEvalTypeInfo( if (bracketLevel == 0 && templateLevel ==0) { if (token == "*") pointerLevel++; - else if (token == "&") - pointerLevel--; else if (syntaxer.getTokenAttribute()->tokenType() == QSynedit::TokenType::Identifier) { baseType += token; } else if (token == "[") {