- enhancement: parser not called when open a file, if option "clean parser symbols when hidden" is turned on.
This commit is contained in:
parent
d0faf50bad
commit
ee9db9cdfd
1
NEWS.md
1
NEWS.md
|
@ -25,6 +25,7 @@ Red Panda C++ Version 0.13.3
|
||||||
- fix: search around option can't be disabled
|
- fix: search around option can't be disabled
|
||||||
- enhancement: show a confirm dialog when search/replace around
|
- enhancement: show a confirm dialog when search/replace around
|
||||||
- enhancement: auto zoom ui when screen's zoom factor changed (windows)
|
- enhancement: auto zoom ui when screen's zoom factor changed (windows)
|
||||||
|
- enhancement: parser not called when open a file, if option "clean parser symbols when hidden" is turned on.
|
||||||
|
|
||||||
Red Panda C++ Version 0.13.2
|
Red Panda C++ Version 0.13.2
|
||||||
- fix: "delete and exit" button in the environtment / folder option page doesn't work correctly
|
- fix: "delete and exit" button in the environtment / folder option page doesn't work correctly
|
||||||
|
|
|
@ -43,7 +43,7 @@ PSynHighlighter HighlighterManager::getHighlighter(const QString &filename)
|
||||||
|| suffix == "CPP" || suffix =="H" || suffix == "c++"
|
|| suffix == "CPP" || suffix =="H" || suffix == "c++"
|
||||||
|| suffix == "h++") {
|
|| suffix == "h++") {
|
||||||
return getCppHighlighter();
|
return getCppHighlighter();
|
||||||
} else if (suffix == "vs" || suffix == "fs") {
|
} else if (suffix == "vs" || suffix == "fs" || suffix == "frag") {
|
||||||
return getGLSLHighlighter();
|
return getGLSLHighlighter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,15 @@ AutolinkManager::AutolinkManager()
|
||||||
|
|
||||||
PAutolink AutolinkManager::getLink(const QString &header) const
|
PAutolink AutolinkManager::getLink(const QString &header) const
|
||||||
{
|
{
|
||||||
return mLinks.value(header,PAutolink());
|
PAutolink link = mLinks.value(header,PAutolink());
|
||||||
|
if (link)
|
||||||
|
return link;
|
||||||
|
foreach (QString key, mLinks.keys()) {
|
||||||
|
if (header.endsWith("/"+key, PATH_SENSITIVITY)) {
|
||||||
|
return mLinks.value(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PAutolink();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutolinkManager::load()
|
void AutolinkManager::load()
|
||||||
|
|
|
@ -534,11 +534,10 @@ QString Compiler::parseFileIncludesForAutolink(
|
||||||
PCppParser& parser)
|
PCppParser& parser)
|
||||||
{
|
{
|
||||||
QString result;
|
QString result;
|
||||||
QString baseName = extractFileName(filename);
|
|
||||||
if (parsedFiles.contains(filename))
|
if (parsedFiles.contains(filename))
|
||||||
return result;
|
return result;
|
||||||
parsedFiles.insert(filename);
|
parsedFiles.insert(filename);
|
||||||
PAutolink autolink = pAutolinkManager->getLink(baseName);
|
PAutolink autolink = pAutolinkManager->getLink(filename);
|
||||||
if (autolink) {
|
if (autolink) {
|
||||||
result += ' '+autolink->linkOption;
|
result += ' '+autolink->linkOption;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,16 +94,16 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
||||||
mCurrentHighlightedWord(),
|
mCurrentHighlightedWord(),
|
||||||
mSaving(false)
|
mSaving(false)
|
||||||
{
|
{
|
||||||
|
qDebug()<<"inited1 ";
|
||||||
mCurrentLineModified = false;
|
mCurrentLineModified = false;
|
||||||
mUseCppSyntax = pSettings->editor().defaultFileCpp();
|
mUseCppSyntax = pSettings->editor().defaultFileCpp();
|
||||||
if (mFilename.isEmpty()) {
|
if (mFilename.isEmpty()) {
|
||||||
mFilename = tr("untitled")+QString("%1").arg(getNewFileNumber());
|
mFilename = tr("untitled")+QString("%1").arg(getNewFileNumber());
|
||||||
}
|
}
|
||||||
|
qDebug()<<"inited2 ";
|
||||||
QFileInfo fileInfo(mFilename);
|
QFileInfo fileInfo(mFilename);
|
||||||
if (mParentPageControl!=nullptr) {
|
|
||||||
mParentPageControl->addTab(this,"");
|
qDebug()<<"inited3 ";
|
||||||
updateCaption();
|
|
||||||
}
|
|
||||||
|
|
||||||
PSynHighlighter highlighter;
|
PSynHighlighter highlighter;
|
||||||
if (!isNew) {
|
if (!isNew) {
|
||||||
|
@ -117,6 +117,8 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
||||||
highlighter=highlighterManager.getCppHighlighter();
|
highlighter=highlighterManager.getCppHighlighter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qDebug()<<"----------inited";
|
||||||
|
|
||||||
if (highlighter) {
|
if (highlighter) {
|
||||||
setHighlighter(highlighter);
|
setHighlighter(highlighter);
|
||||||
setUseCodeFolding(true);
|
setUseCodeFolding(true);
|
||||||
|
@ -134,7 +136,6 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
||||||
&& mParser && (mParser->isSystemHeaderFile(mFilename) || mParser->isProjectHeaderFile(mFilename))) {
|
&& mParser && (mParser->isSystemHeaderFile(mFilename) || mParser->isProjectHeaderFile(mFilename))) {
|
||||||
this->setModified(false);
|
this->setModified(false);
|
||||||
setReadOnly(true);
|
setReadOnly(true);
|
||||||
updateCaption();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mCompletionPopup = pMainWindow->completionPopup();
|
mCompletionPopup = pMainWindow->completionPopup();
|
||||||
|
@ -180,6 +181,10 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
||||||
resetBreakpoints();
|
resetBreakpoints();
|
||||||
}
|
}
|
||||||
mStatementColors = pMainWindow->statementColors();
|
mStatementColors = pMainWindow->statementColors();
|
||||||
|
if (mParentPageControl!=nullptr) {
|
||||||
|
mParentPageControl->addTab(this,"");
|
||||||
|
updateCaption();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Editor::~Editor() {
|
Editor::~Editor() {
|
||||||
|
@ -524,12 +529,6 @@ void Editor::wheelEvent(QWheelEvent *event) {
|
||||||
void Editor::focusInEvent(QFocusEvent *event)
|
void Editor::focusInEvent(QFocusEvent *event)
|
||||||
{
|
{
|
||||||
SynEdit::focusInEvent(event);
|
SynEdit::focusInEvent(event);
|
||||||
if (mParser) {
|
|
||||||
connect(mParser.get(),
|
|
||||||
&CppParser::onEndParsing,
|
|
||||||
this,
|
|
||||||
&SynEdit::invalidate);
|
|
||||||
}
|
|
||||||
pMainWindow->updateAppTitle();
|
pMainWindow->updateAppTitle();
|
||||||
pMainWindow->updateEditorActions();
|
pMainWindow->updateEditorActions();
|
||||||
pMainWindow->updateStatusbarForLineCol();
|
pMainWindow->updateStatusbarForLineCol();
|
||||||
|
@ -540,12 +539,6 @@ void Editor::focusInEvent(QFocusEvent *event)
|
||||||
void Editor::focusOutEvent(QFocusEvent *event)
|
void Editor::focusOutEvent(QFocusEvent *event)
|
||||||
{
|
{
|
||||||
SynEdit::focusOutEvent(event);
|
SynEdit::focusOutEvent(event);
|
||||||
if (mParser) {
|
|
||||||
disconnect(mParser.get(),
|
|
||||||
&CppParser::onEndParsing,
|
|
||||||
this,
|
|
||||||
&SynEdit::invalidate);
|
|
||||||
}
|
|
||||||
//pMainWindow->updateClassBrowserForEditor(nullptr);
|
//pMainWindow->updateClassBrowserForEditor(nullptr);
|
||||||
pMainWindow->updateStatusbarForLineCol();
|
pMainWindow->updateStatusbarForLineCol();
|
||||||
pMainWindow->updateForStatusbarModeInfo();
|
pMainWindow->updateForStatusbarModeInfo();
|
||||||
|
@ -1195,6 +1188,41 @@ void Editor::closeEvent(QCloseEvent *)
|
||||||
pMainWindow->functionTip()->hide();
|
pMainWindow->functionTip()->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Editor::showEvent(QShowEvent */*event*/)
|
||||||
|
{
|
||||||
|
qDebug()<<"show event";
|
||||||
|
if (pSettings->codeCompletion().clearWhenEditorHidden()
|
||||||
|
&& !inProject()) {
|
||||||
|
initParser();
|
||||||
|
}
|
||||||
|
if (mParser) {
|
||||||
|
connect(mParser.get(),
|
||||||
|
&CppParser::onEndParsing,
|
||||||
|
this,
|
||||||
|
&SynEdit::invalidate);
|
||||||
|
}
|
||||||
|
if (pSettings->codeCompletion().clearWhenEditorHidden()
|
||||||
|
&& !inProject()) {
|
||||||
|
reparse();
|
||||||
|
}
|
||||||
|
reparseTodo();
|
||||||
|
setHideTime(QDateTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Editor::hideEvent(QHideEvent */*event*/)
|
||||||
|
{
|
||||||
|
if (mParser) {
|
||||||
|
disconnect(mParser.get(),
|
||||||
|
&CppParser::onEndParsing,
|
||||||
|
this,
|
||||||
|
&SynEdit::invalidate);
|
||||||
|
}
|
||||||
|
if (pSettings->codeCompletion().clearWhenEditorHidden()
|
||||||
|
&& !inProject() && mParser)
|
||||||
|
mParser->reset();
|
||||||
|
setHideTime(QDateTime::currentDateTime());
|
||||||
|
}
|
||||||
|
|
||||||
void Editor::copyToClipboard()
|
void Editor::copyToClipboard()
|
||||||
{
|
{
|
||||||
if (pSettings->editor().copySizeLimit()) {
|
if (pSettings->editor().copySizeLimit()) {
|
||||||
|
@ -2407,6 +2435,7 @@ void Editor::reparse()
|
||||||
if (highlighter()->language() != SynHighlighterLanguage::Cpp
|
if (highlighter()->language() != SynHighlighterLanguage::Cpp
|
||||||
&& highlighter()->language() != SynHighlighterLanguage::GLSL)
|
&& highlighter()->language() != SynHighlighterLanguage::GLSL)
|
||||||
return;
|
return;
|
||||||
|
qDebug()<<"reparse"<<mParser.get()<<mFilename<<mInProject;
|
||||||
parseFile(mParser,mFilename,mInProject);
|
parseFile(mParser,mFilename,mInProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3124,7 +3153,7 @@ QString Editor::getFileHint(const QString &s)
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Editor::getParserHint(const QStringList& expression,const QString &s, int line)
|
QString Editor::getParserHint(const QStringList& expression,const QString &/*s*/, int line)
|
||||||
{
|
{
|
||||||
// This piece of code changes the parser database, possibly making hints and code completion invalid...
|
// This piece of code changes the parser database, possibly making hints and code completion invalid...
|
||||||
QString result;
|
QString result;
|
||||||
|
|
|
@ -372,6 +372,11 @@ protected:
|
||||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||||
void inputMethodEvent(QInputMethodEvent *) override;
|
void inputMethodEvent(QInputMethodEvent *) override;
|
||||||
void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
|
|
||||||
|
// QWidget interface
|
||||||
|
protected:
|
||||||
|
void showEvent(QShowEvent *event) override;
|
||||||
|
void hideEvent(QHideEvent *event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
QString getWordAtPosition(SynEdit* editor,
|
QString getWordAtPosition(SynEdit* editor,
|
||||||
|
|
|
@ -954,8 +954,6 @@ void MainWindow::openFiles(const QStringList &files)
|
||||||
auto end = finally([this] {
|
auto end = finally([this] {
|
||||||
this->mEditorList->endUpdate();
|
this->mEditorList->endUpdate();
|
||||||
mOpenningFiles = false;
|
mOpenningFiles = false;
|
||||||
updateEditorParser(ui->EditorTabsLeft);
|
|
||||||
updateEditorParser(ui->EditorTabsRight);
|
|
||||||
});
|
});
|
||||||
//Check if there is a project file in the list and open it
|
//Check if there is a project file in the list and open it
|
||||||
for (const QString& file:files) {
|
for (const QString& file:files) {
|
||||||
|
@ -5222,39 +5220,6 @@ PSymbolUsageManager &MainWindow::symbolUsageManager()
|
||||||
return mSymbolUsageManager;
|
return mSymbolUsageManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateEditorParser(QTabWidget* tabWidget) {
|
|
||||||
if (mOpenningFiles)
|
|
||||||
return;
|
|
||||||
Editor * editor = mEditorList->getEditor(-1,tabWidget);
|
|
||||||
if (pSettings->codeCompletion().clearWhenEditorHidden()) {
|
|
||||||
for (int i=0;i<tabWidget->count();i++) {
|
|
||||||
Editor * e = (Editor*)(tabWidget->widget(i));
|
|
||||||
if (!e->inProject()) {
|
|
||||||
if (e!=editor && e->parser() && !e->notParsed()) {
|
|
||||||
e->parser()->reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (editor && editor->parser() && editor->notParsed()) {
|
|
||||||
resetCppParser(editor->parser());
|
|
||||||
editor->reparse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::updateEditorHideTime(QTabWidget* tabWidget) {
|
|
||||||
Editor * editor = mEditorList->getEditor(-1,tabWidget);
|
|
||||||
for (int i=0;i<tabWidget->count();i++) {
|
|
||||||
Editor * e = (Editor*)(tabWidget->widget(i));
|
|
||||||
if (e!=editor) {
|
|
||||||
if (!e->hideTime().isValid())
|
|
||||||
e->setHideTime(QDateTime::currentDateTime());
|
|
||||||
} else {
|
|
||||||
e->setHideTime(QDateTime());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::showHideInfosTab(QWidget *widget, bool show)
|
void MainWindow::showHideInfosTab(QWidget *widget, bool show)
|
||||||
{
|
{
|
||||||
int idx = findTabIndex(ui->tabInfos,widget);
|
int idx = findTabIndex(ui->tabInfos,widget);
|
||||||
|
@ -5393,25 +5358,12 @@ void MainWindow::onEditorRenamed(const QString &oldFilename, const QString &newF
|
||||||
|
|
||||||
void MainWindow::on_EditorTabsLeft_currentChanged(int)
|
void MainWindow::on_EditorTabsLeft_currentChanged(int)
|
||||||
{
|
{
|
||||||
Editor * editor = mEditorList->getEditor(-1,ui->EditorTabsLeft);
|
|
||||||
if (editor) {
|
|
||||||
editor->reparseTodo();
|
|
||||||
}
|
|
||||||
updateEditorParser(ui->EditorTabsLeft);
|
|
||||||
updateEditorHideTime(ui->EditorTabsLeft);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::on_EditorTabsRight_currentChanged(int)
|
void MainWindow::on_EditorTabsRight_currentChanged(int)
|
||||||
{
|
{
|
||||||
Editor * editor = mEditorList->getEditor(-1,ui->EditorTabsRight);
|
|
||||||
if (editor) {
|
|
||||||
editor->reparseTodo();
|
|
||||||
}
|
}
|
||||||
updateEditorParser(ui->EditorTabsRight);
|
|
||||||
updateEditorHideTime(ui->EditorTabsRight);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::on_tableTODO_doubleClicked(const QModelIndex &index)
|
void MainWindow::on_tableTODO_doubleClicked(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
|
@ -5422,7 +5374,6 @@ void MainWindow::on_tableTODO_doubleClicked(const QModelIndex &index)
|
||||||
editor->setCaretPositionAndActivate(item->lineNo,item->ch+1);
|
editor->setCaretPositionAndActivate(item->lineNo,item->ch+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -243,8 +243,6 @@ private:
|
||||||
void doCompileRun(RunType runType);
|
void doCompileRun(RunType runType);
|
||||||
void updateProblemCaseOutput(POJProblemCase problemCase);
|
void updateProblemCaseOutput(POJProblemCase problemCase);
|
||||||
void applyCurrentProblemCaseChanges();
|
void applyCurrentProblemCaseChanges();
|
||||||
void updateEditorParser(QTabWidget* tabWidget);
|
|
||||||
void updateEditorHideTime(QTabWidget* tabWidget);
|
|
||||||
void showHideInfosTab(QWidget *widget, bool show);
|
void showHideInfosTab(QWidget *widget, bool show);
|
||||||
void showHideMessagesTab(QWidget *widget, bool show);
|
void showHideMessagesTab(QWidget *widget, bool show);
|
||||||
void prepareTabInfosData();
|
void prepareTabInfosData();
|
||||||
|
|
|
@ -50,6 +50,7 @@ void EditorCodeCompletionWidget::doLoad()
|
||||||
ui->chkIgnoreCases->setChecked(pSettings->codeCompletion().ignoreCase());
|
ui->chkIgnoreCases->setChecked(pSettings->codeCompletion().ignoreCase());
|
||||||
ui->chkAppendFunc->setChecked(pSettings->codeCompletion().appendFunc());
|
ui->chkAppendFunc->setChecked(pSettings->codeCompletion().appendFunc());
|
||||||
ui->chkShowCodeIns->setChecked(pSettings->codeCompletion().showCodeIns());
|
ui->chkShowCodeIns->setChecked(pSettings->codeCompletion().showCodeIns());
|
||||||
|
ui->chkClearWhenEditorHidden->setChecked(pSettings->codeCompletion().clearWhenEditorHidden());
|
||||||
|
|
||||||
ui->spinMinCharRequired->setValue(pSettings->codeCompletion().minCharRequired());
|
ui->spinMinCharRequired->setValue(pSettings->codeCompletion().minCharRequired());
|
||||||
}
|
}
|
||||||
|
@ -74,6 +75,7 @@ void EditorCodeCompletionWidget::doSave()
|
||||||
pSettings->codeCompletion().setShowCodeIns(ui->chkShowCodeIns->isChecked());
|
pSettings->codeCompletion().setShowCodeIns(ui->chkShowCodeIns->isChecked());
|
||||||
pSettings->codeCompletion().setMinCharRequired(ui->spinMinCharRequired->value());
|
pSettings->codeCompletion().setMinCharRequired(ui->spinMinCharRequired->value());
|
||||||
|
|
||||||
|
pSettings->codeCompletion().setClearWhenEditorHidden(ui->chkClearWhenEditorHidden->isChecked());
|
||||||
|
|
||||||
pSettings->codeCompletion().save();
|
pSettings->codeCompletion().save();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue