- fix: auto syntax check doesn't work for new files
- change: don't auto jump to the first syntax error location when compile
This commit is contained in:
parent
7e284b98f2
commit
01662a95d1
2
NEWS.md
2
NEWS.md
|
@ -8,6 +8,8 @@ Red Panda C++ Version 1.0.3
|
|||
- fix: crash when editing txt file and input symbol at the beginning of a line
|
||||
- fix: ctrl+shift+end doesn't select
|
||||
- fix: don't show tips in the editor, when selecting by mouse
|
||||
- fix: auto syntax check doesn't work for new files
|
||||
- change: don't auto jump to the first syntax error location when compile
|
||||
|
||||
Red Panda C++ Version 1.0.2
|
||||
- enhancement: press tab in column mode won't exit column mode
|
||||
|
|
|
@ -32,20 +32,16 @@ HighlighterManager::HighlighterManager()
|
|||
|
||||
PSynHighlighter HighlighterManager::getHighlighter(const QString &filename)
|
||||
{
|
||||
if (filename.isEmpty() || filename.startsWith(QObject::tr("untitled"))) {
|
||||
QFileInfo info(filename);
|
||||
QString suffix = info.suffix();
|
||||
if (suffix.isEmpty() || suffix == "c" || suffix == "cpp" || suffix == "cxx"
|
||||
|| suffix == "cc" || suffix == "h" || suffix == "hpp"
|
||||
|| suffix == "hxx" || suffix == "hh" || suffix == "C"
|
||||
|| suffix == "CPP" || suffix =="H" || suffix == "c++"
|
||||
|| suffix == "h++") {
|
||||
return getCppHighlighter();
|
||||
} else {
|
||||
QFileInfo info(filename);
|
||||
QString suffix = info.suffix();
|
||||
if (suffix.isEmpty() || suffix == "c" || suffix == "cpp" || suffix == "cxx"
|
||||
|| suffix == "cc" || suffix == "h" || suffix == "hpp"
|
||||
|| suffix == "hxx" || suffix == "hh" || suffix == "C"
|
||||
|| suffix == "CPP" || suffix =="H" || suffix == "c++"
|
||||
|| suffix == "h++") {
|
||||
return getCppHighlighter();
|
||||
} else if (suffix == "vs" || suffix == "fs" || suffix == "frag") {
|
||||
return getGLSLHighlighter();
|
||||
}
|
||||
} else if (suffix == "vs" || suffix == "fs" || suffix == "frag") {
|
||||
return getGLSLHighlighter();
|
||||
}
|
||||
return PSynHighlighter();
|
||||
}
|
||||
|
|
|
@ -1115,7 +1115,7 @@ bool Editor::event(QEvent *event)
|
|||
if (pMainWindow->functionTip()->isVisible()) {
|
||||
pMainWindow->functionTip()->hide();
|
||||
}
|
||||
QToolTip::showText(mapToGlobal(helpEvent->pos()),hint);
|
||||
QToolTip::showText(mapToGlobal(helpEvent->pos()),hint,this);
|
||||
event->ignore();
|
||||
} else {
|
||||
updateMouseCursor();
|
||||
|
@ -1618,7 +1618,7 @@ void Editor::onTipEvalValueReady(const QString& value)
|
|||
} else {
|
||||
newValue = value;
|
||||
}
|
||||
QToolTip::showText(QCursor::pos(), mCurrentDebugTipWord + " = " + newValue);
|
||||
QToolTip::showText(QCursor::pos(), mCurrentDebugTipWord + " = " + newValue, this);
|
||||
}
|
||||
disconnect(pMainWindow->debugger(), &Debugger::evalValueReady,
|
||||
this, &Editor::onTipEvalValueReady);
|
||||
|
@ -1753,7 +1753,11 @@ QStringList Editor::getExpressionAtPosition(
|
|||
int ch = pos.Char-1;
|
||||
int symbolMatchingLevel = 0;
|
||||
LastSymbolType lastSymbolType=LastSymbolType::None;
|
||||
PSynHighlighter highlighter = highlighterManager.getHighlighter(mFilename);
|
||||
PSynHighlighter highlighter;
|
||||
if (isNew())
|
||||
highlighter = highlighterManager.getCppHighlighter();
|
||||
else
|
||||
highlighter = highlighterManager.getHighlighter(mFilename);
|
||||
if (!highlighter)
|
||||
return result;
|
||||
while (true) {
|
||||
|
|
|
@ -1446,13 +1446,15 @@ void MainWindow::checkSyntaxInBack(Editor *e)
|
|||
// if not devEditor.AutoCheckSyntax then
|
||||
// Exit;
|
||||
//not c or cpp file
|
||||
FileType fileType = getFileType(e->filename());
|
||||
if (fileType != FileType::CSource
|
||||
&& fileType != FileType::CppSource
|
||||
&& fileType != FileType::CHeader
|
||||
&& fileType != FileType::CppHeader
|
||||
)
|
||||
return;
|
||||
if (!e->isNew()) {
|
||||
FileType fileType = getFileType(e->filename());
|
||||
if (fileType != FileType::CSource
|
||||
&& fileType != FileType::CppSource
|
||||
&& fileType != FileType::CHeader
|
||||
&& fileType != FileType::CppHeader
|
||||
)
|
||||
return;
|
||||
}
|
||||
if (mCompilerManager->backgroundSyntaxChecking())
|
||||
return;
|
||||
if (mCompilerManager->compiling())
|
||||
|
@ -4546,21 +4548,17 @@ void MainWindow::onCompileFinished(bool isCheckSyntax)
|
|||
}
|
||||
}
|
||||
|
||||
// Close it if there's nothing to show
|
||||
if (isCheckSyntax) {
|
||||
// check syntax in back, don't change message panel
|
||||
} else if (
|
||||
(ui->tableIssues->count() == 0)
|
||||
) {
|
||||
openCloseBottomPanel(false);
|
||||
// Or open it if there is anything to show
|
||||
} else if (ui->tableIssues->count() == 0) {
|
||||
// Close it if there's nothing to show
|
||||
if (ui->tabMessages->currentIndex() == i)
|
||||
openCloseBottomPanel(false);
|
||||
} else {
|
||||
if (ui->tableIssues->count() > 0) {
|
||||
if (ui->tabMessages->currentIndex() != i) {
|
||||
ui->tabMessages->setCurrentIndex(i);
|
||||
}
|
||||
openCloseBottomPanel(true);
|
||||
if (ui->tabMessages->currentIndex() != i) {
|
||||
ui->tabMessages->setCurrentIndex(i);
|
||||
}
|
||||
openCloseBottomPanel(true);
|
||||
}
|
||||
|
||||
Editor * e = mEditorList->getEditor();
|
||||
|
@ -4590,28 +4588,26 @@ void MainWindow::onCompileFinished(bool isCheckSyntax)
|
|||
mCompileSuccessionTask.reset();
|
||||
// Jump to problem location, sorted by significance
|
||||
} else if ((mCompilerManager->compileIssueCount() > 0) && (!mCheckSyntaxInBack)) {
|
||||
bool hasError = false;
|
||||
// First try to find errors
|
||||
for (int i=0;i<ui->tableIssues->count();i++) {
|
||||
PCompileIssue issue = ui->tableIssues->issue(i);
|
||||
if (issue->type == CompileIssueType::Error) {
|
||||
if (e && e->filename() != issue->filename)
|
||||
continue;
|
||||
ui->tableIssues->selectRow(i);
|
||||
QModelIndex index =ui->tableIssues->model()->index(i,0);
|
||||
emit ui->tableIssues->doubleClicked(index);
|
||||
ui->tabIssues->setFocus();
|
||||
hasError = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Then try to find warnings
|
||||
for (int i=0;i<ui->tableIssues->count();i++) {
|
||||
PCompileIssue issue = ui->tableIssues->issue(i);
|
||||
if (issue->type == CompileIssueType::Warning) {
|
||||
if (e && e->filename() != issue->filename)
|
||||
continue;
|
||||
ui->tableIssues->selectRow(i);
|
||||
QModelIndex index =ui->tableIssues->model()->index(i,0);
|
||||
emit ui->tableIssues->doubleClicked(index);
|
||||
if (!hasError) {
|
||||
// Then try to find warnings
|
||||
for (int i=0;i<ui->tableIssues->count();i++) {
|
||||
PCompileIssue issue = ui->tableIssues->issue(i);
|
||||
if (issue->type == CompileIssueType::Warning) {
|
||||
ui->tableIssues->selectRow(i);
|
||||
ui->tabIssues->setFocus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue