From 68209fe619ed9fe07dff2cb106d7c4c07f988346 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Fri, 3 May 2024 08:38:54 +0800 Subject: [PATCH] fix: project not correctly reparsed after rename unit. --- NEWS.md | 1 + RedPandaIDE/project.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) 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);