Skip to content

Commit

Permalink
- fix: Class browser is empty when ctrl+click to open a file.
Browse files Browse the repository at this point in the history
  • Loading branch information
royqh1979 committed Dec 21, 2024
1 parent dfe915e commit eeba1f5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Red Panda C++ Version 3.3
- enhancement: Add the option "Clear symbols in hidden source files" in option / environment / performance. (Turned on by default)
- enhancement: Treat .tcc file as C/C++ header file.
- enhancement: Save encoding / filetype /context file infos of last openned files.
- fix: Class browser is empty when ctrl+click to open a file.

Red Panda C++ Version 3.2

Expand Down
18 changes: 12 additions & 6 deletions RedPandaIDE/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1502,17 +1502,13 @@ void Editor::showEvent(QShowEvent */*event*/)
this,
&Editor::onEndParsing);
if (!pMainWindow->openingFiles() && !pMainWindow->openingProject()) {
bool needReparse=((isC_CPPHeaderFile(mFileType)
&& !mContextFile.isEmpty()
&& !mParser->isFileParsed(mContextFile))
|| (!mParser->isFileParsed(mFilename)));
if (pSettings->codeCompletion().clearWhenEditorHidden()
&& pSettings->codeCompletion().shareParser()
&& !inProject()) {
if (needReparse)
if (needReparse())
resetCppParser(mParser);
}
if (needReparse) {
if (needReparse()) {
reparse(false);
}
}
Expand Down Expand Up @@ -4613,10 +4609,20 @@ Editor* Editor::openFileInContext(const QString &filename)
e->setContextFile(mContextFile);
}
}
if (e->isVisible())
pMainWindow->updateClassBrowserForEditor(e);
}
return e;
}

bool Editor::needReparse()
{
return mParser && ((isC_CPPHeaderFile(mFileType)
&& !mContextFile.isEmpty()
&& !mParser->isFileParsed(mContextFile))
|| (!mParser->isFileParsed(mFilename)));
}

const QString &Editor::contextFile() const
{
return mContextFile;
Expand Down
1 change: 1 addition & 0 deletions RedPandaIDE/editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ private slots:
void doSetFileType(FileType newFileType, bool force=false);

Editor* openFileInContext(const QString& filename);
bool needReparse();

private:
bool mInited;
Expand Down
1 change: 0 additions & 1 deletion RedPandaIDE/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,6 @@ void MainWindow::updateClassBrowserForEditor(Editor *editor)
return;
}


mClassBrowserModel->beginUpdate();
mClassBrowserModel->setParser(editor->parser());
if (editor->inProject()) {
Expand Down

0 comments on commit eeba1f5

Please sign in to comment.