- enhancement: Show "std::function" in the completion list.
This commit is contained in:
parent
ce45cae6ed
commit
aad4050c25
1
NEWS.md
1
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.
|
||||
|
|
|
@ -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()<<newCommand<<templateSpecializationParams;
|
||||
}
|
||||
newCommand.squeeze();
|
||||
// if (newCommand.startsWith("::") && parent && kind!=StatementKind::skBlock ) {
|
||||
// qDebug()<<command<<fileName<<line<<kind<<parent->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"<<timer.elapsed();
|
||||
#ifdef QT_DEBUG
|
||||
// mStatementList.dumpAll(QString("r:\\all-stats-%1.txt").arg(extractFileName(fileName)));
|
||||
// mStatementList.dump(QString("r:\\stats-%1.txt").arg(extractFileName(fileName)));
|
||||
mStatementList.dumpAll(QString("r:\\all-stats-%1.txt").arg(extractFileName(fileName)));
|
||||
mStatementList.dump(QString("r:\\stats-%1.txt").arg(extractFileName(fileName)));
|
||||
#endif
|
||||
//reduce memory usage
|
||||
internalClear();
|
||||
|
|
|
@ -184,6 +184,7 @@ struct Statement {
|
|||
QString command; // identifier/name of statement "foo"
|
||||
QString args; // args "(int a,float b)"
|
||||
QString value; // Used for macro defines/typedef, "100" in "#defin COUNT 100"
|
||||
QString templateSpecializationParams;
|
||||
StatementKind kind; // kind of statement class/variable/function/etc
|
||||
StatementScope scope; // global/local/classlocal
|
||||
StatementAccessibility accessibility; // protected/private/public
|
||||
|
|
|
@ -296,7 +296,7 @@ void CodeCompletionPopup::addStatement(const PStatement& statement, const QStrin
|
|||
&& (fileName == statement->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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue