- fix: disable code completion doesn't correctly disable project parser

This commit is contained in:
Roy Qu 2022-03-22 19:08:26 +08:00
parent 0e0a87584e
commit 6e4d36aade
3 changed files with 18 additions and 12 deletions

View File

@ -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

View File

@ -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,8 +1187,6 @@ 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);
@ -1198,7 +1195,6 @@ void MainWindow::changeOptions(const QString &widgetName, const QString &groupNa
} 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);

View File

@ -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)
{
if (mEnabled!=newEnabled) {
mEnabled = newEnabled;
if (!mEnabled) {
this->reset();
}
}
}
CppFileParserThread::CppFileParserThread(