diff --git a/NEWS.md b/NEWS.md index 432b0bc4..1a0467dd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -74,6 +74,7 @@ Red Panda C++ Version 2.27 - fix: Filename that contains '&' doesn't correctly displayed in the editor tab. - enhancement: Type induction for "auto &&" vars. - enhancement: Syntax highlighting for c++ attributes. + - enhancement: Show "std::function" in the completion list. Red Panda C++ Version 2.26 - enhancement: Code suggestion for embedded std::vectors. diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index 20545d47..01d575c2 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -1397,6 +1397,13 @@ PStatement CppParser::addStatement(const PStatement& parent, newType += newCommand.front(); newCommand.remove(0,1); // remove first } + QString templateSpecializationParams; + int pos = newCommand.indexOf("<"); + if (pos>0 && !newCommand.startsWith("operator<")) { + templateSpecializationParams = newCommand.mid(pos); + newCommand = newCommand.left(pos); + qDebug()<fullName; @@ -1437,6 +1444,7 @@ PStatement CppParser::addStatement(const PStatement& parent, result->args = args; result->noNameArgs = noNameArgs; result->value = value; + result->templateSpecializationParams = templateSpecializationParams; result->kind = kind; result->scope = scope; result->accessibility = accessibility; @@ -1457,7 +1465,7 @@ PStatement CppParser::addStatement(const PStatement& parent, if (scope == StatementScope::Local) result->fullName = newCommand; else - result->fullName = getFullStatementName(newCommand, parent); + result->fullName = getFullStatementName(newCommand + templateSpecializationParams, parent); result->usageCount = -1; result->args.squeeze(); @@ -4560,8 +4568,8 @@ void CppParser::internalParse(const QString &fileName) handleInheritances(); // qDebug()<<"parse"<fileName)) return; mAddedStatements.insert(statement->command); - if (statement->kind == StatementKind::skUserCodeSnippet || !statement->fullName.contains("<")) + if (statement->kind == StatementKind::skUserCodeSnippet || !statement->command.contains("<")) mFullCompletionStatementList.append(statement); }