diff --git a/NEWS.md b/NEWS.md index 40b1cd53..4fad9532 100644 --- a/NEWS.md +++ b/NEWS.md @@ -13,6 +13,7 @@ Red Panda C++ Version 1.0.1 - fix: expand fold signs on the gutter are not correct - enhancement: auto restore mainwindow when open files in one instance - fix: the problem & problem set panel can't be correctly , if problem set is enabled + - fix: disable code completion doesn't correctly disable project parser Red Panda C++ Version 1.0.0 - fix: calculation for code snippets's tab stop positions is not correct diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index b8f6c524..ef6629a9 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -1176,7 +1176,6 @@ void MainWindow::openProject(const QString &filename, bool openFiles) void MainWindow::changeOptions(const QString &widgetName, const QString &groupName) { - bool oldCodeCompletion = pSettings->codeCompletion().enabled(); PSettingsDialog settingsDialog = SettingsDialog::optionDialog(); if (!groupName.isEmpty()) { settingsDialog->setCurrentWidget(widgetName, groupName); @@ -1188,16 +1187,13 @@ void MainWindow::changeOptions(const QString &widgetName, const QString &groupNa return; } - bool newCodeCompletion = pSettings->codeCompletion().enabled(); - if (!oldCodeCompletion && newCodeCompletion) { - Editor *e = mEditorList->getEditor(); - if (mProject && !e) { - scanActiveProject(true); - } else if (mProject && e && e->inProject()) { - scanActiveProject(true); - } else if (e) { - e->reparse(); - } + Editor *e = mEditorList->getEditor(); + if (mProject && !e) { + scanActiveProject(true); + } else if (mProject && e && e->inProject()) { + scanActiveProject(true); + } else if (e) { + e->reparse(); } } @@ -2015,6 +2011,8 @@ void MainWindow::scanActiveProject(bool parse) { if (!mProject) return; + mProject->cppParser()->setEnabled(pSettings->codeCompletion().enabled()); + //UpdateClassBrowsing; if (parse) { resetCppParser(mProject->cppParser(),mProject->options().compilerSet); diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index f7df64c6..5e0e6b73 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -699,6 +699,8 @@ QString CppParser::getHeaderFileName(const QString &relativeTo, const QString &l void CppParser::invalidateFile(const QString &fileName) { + if (!mEnabled) + return; { QMutexLocker locker(&mMutex); if (mParsing || mLockCount>0) @@ -4806,7 +4808,12 @@ bool CppParser::enabled() const void CppParser::setEnabled(bool newEnabled) { - mEnabled = newEnabled; + if (mEnabled!=newEnabled) { + mEnabled = newEnabled; + if (!mEnabled) { + this->reset(); + } + } } CppFileParserThread::CppFileParserThread(