- fix: class browser not correctly displayed when "whole project" is checked

This commit is contained in:
Roy Qu 2022-10-23 23:24:26 +08:00
parent 09c7b5e791
commit aa6951c2ca
2 changed files with 11 additions and 14 deletions

View File

@ -12,6 +12,7 @@ Red Panda C++ Version 2.0
- fix: statements is the class browser is correctly sorted - fix: statements is the class browser is correctly sorted
- enhancement: Weither double click on the class browser should goto definition/declaration, depends on the current cursor position - enhancement: Weither double click on the class browser should goto definition/declaration, depends on the current cursor position
- enhancement: keep current position in the class browser after contents modified - enhancement: keep current position in the class browser after contents modified
- fix: "." and ".." in included header paths not correctly handled
Red Panda C++ Version 1.5 Red Panda C++ Version 1.5

View File

@ -351,19 +351,18 @@ void ClassBrowserModel::filterChildren(ClassBrowserNode *node, const StatementMa
ClassBrowserNode *parentNode=node; ClassBrowserNode *parentNode=node;
// we only test and handle orphan statements in the top level (node->statement is null) // we only test and handle orphan statements in the top level (node->statement is null)
PStatement parentScope = statement->parentScope.lock(); PStatement parentScope = statement->parentScope.lock();
if ( (mClassBrowserType==ProjectClassBrowserType::CurrentFile) if ( (parentScope!=node->statement)
&& (parentScope!=node->statement)
&& (!parentScope || !node->statement && (!parentScope || !node->statement
|| parentScope->fullName!=node->statement->fullName)) { || parentScope->fullName!=node->statement->fullName)) {
// //should not happend, just in case of error // //should not happend, just in case of error
if (!parentScope) // if (!parentScope)
continue; // continue;
// Processing the orphan statement // Processing the orphan statement
//the statement's parent is in this file, so it's not a real orphan //the statement's parent is in this file, so it's not a real orphan
if ((parentScope->fileName==mCurrentFile) // if ((parentScope->fileName==mCurrentFile)
||(parentScope->definitionFileName==mCurrentFile)) // ||(parentScope->definitionFileName==mCurrentFile))
continue; // continue;
ClassBrowserNode *dummyNode = getParentNode(parentScope,1); ClassBrowserNode *dummyNode = getParentNode(parentScope,1);
if (dummyNode) if (dummyNode)
@ -371,15 +370,12 @@ void ClassBrowserModel::filterChildren(ClassBrowserNode *node, const StatementMa
} }
if (statement->kind == StatementKind::skNamespace || statement->kind == StatementKind::skClass) { if (statement->kind == StatementKind::skNamespace || statement->kind == StatementKind::skClass) {
//PStatement dummy = mDummyStatements.value(statement->fullName,PStatement()); //PStatement dummy = mDummyStatements.value(statement->fullName,PStatement());
PClassBrowserNode dummyNode = mScopeNodes.value(statement->fullName,PClassBrowserNode()); PClassBrowserNode scopeNode = mScopeNodes.value(statement->fullName,PClassBrowserNode());
if (dummyNode) { if (!scopeNode) {
filterChildren(dummyNode.get(),statement->children);
continue;
} else {
PStatement dummy = createDummy(statement); PStatement dummy = createDummy(statement);
dummy->children = statement->children; scopeNode = addChild(parentNode,dummy);
dummyNode = addChild(parentNode,dummy);
} }
filterChildren(scopeNode.get(),statement->children);
} else { } else {
addChild(parentNode,statement); addChild(parentNode,statement);
} }