diff --git a/NEWS.md b/NEWS.md index 757008a0..c51db105 100644 --- a/NEWS.md +++ b/NEWS.md @@ -157,6 +157,7 @@ Red Panda C++ Version 2.27 - fix: Current editor wouldn't get parsed, when it's switched from another editor being parsed. - enhancement: Support macro in #include preprocessing statements. - fix: In options -> code format -> Program, Choose astyle path button doesn't work. + - fix: project not correctly reparsed after rename unit. Red Panda C++ Version 2.26 - enhancement: Code suggestion for embedded std::vectors. diff --git a/RedPandaIDE/project.cpp b/RedPandaIDE/project.cpp index b85c7d5d..2321a281 100644 --- a/RedPandaIDE/project.cpp +++ b/RedPandaIDE/project.cpp @@ -704,17 +704,17 @@ void Project::renameUnit(PProjectUnit& unit, const QString &newFileName) mParser->addProjectFile(newFileName,true); } + if (mParser) + mParser->invalidateFile(unit->fileName()); Editor * editor=unitEditor(unit); if (editor) { //prevent recurse editor->saveAs(newFileName,true); } else { - if (mParser) - mParser->invalidateFile(unit->fileName()); copyFile(unit->fileName(),newFileName,true); - if (mParser) - mParser->parseFile(newFileName,true); } + if (mParser) + mParser->parseFile(newFileName,true); internalRemoveUnit(unit,false,true);