- fix: syntax issues' filepath info not correct when build projects

This commit is contained in:
royqh1979 2021-10-25 09:31:58 +08:00
parent 59ea699fb7
commit 3a7065e9d8
6 changed files with 24 additions and 7 deletions

View File

@ -10,6 +10,7 @@ Version 0.7.3
- enhancement: when running a program, redirect a data file to its stdin - enhancement: when running a program, redirect a data file to its stdin
- fix: can't correctly handle '&&' and '||' in the #if directive (and correctly parse windows.h header file) - fix: can't correctly handle '&&' and '||' in the #if directive (and correctly parse windows.h header file)
- fix: crash when create an empty project - fix: crash when create an empty project
- fix: syntax issues' filepath info not correct when build projects
Version 0.7.2 Version 0.7.2
- fix: rainbow parenthesis stop functioning when change editor's general options - fix: rainbow parenthesis stop functioning when change editor's general options

View File

@ -295,6 +295,8 @@ QString Compiler::getCCompileArguments(bool checkSyntax)
value = pOption->value; value = pOption->value;
} }
if (value > 0 && pOption->isC) { if (value > 0 && pOption->isC) {
if (checkSyntax && pOption->isLinker)
continue;
if (pOption->choices.isEmpty()) { if (pOption->choices.isEmpty()) {
result += " " + pOption->setting; result += " " + pOption->setting;
} else if (value < pOption->choices.size()) { } else if (value < pOption->choices.size()) {
@ -342,6 +344,8 @@ QString Compiler::getCppCompileArguments(bool checkSyntax)
value = pOption->value; value = pOption->value;
} }
if (value > 0 && pOption->isCpp) { if (value > 0 && pOption->isCpp) {
if (checkSyntax && pOption->isLinker)
continue;
if (pOption->choices.isEmpty()) { if (pOption->choices.isEmpty()) {
result += " " + pOption->setting; result += " " + pOption->setting;
} else if (value < pOption->choices.size()) { } else if (value < pOption->choices.size()) {

View File

@ -59,7 +59,8 @@ bool FileCompiler::prepareForCompile()
throw CompileError(tr("Can't find the compiler for file %1").arg(mFilename)); throw CompileError(tr("Can't find the compiler for file %1").arg(mFilename));
} }
mArguments += getLibraryArguments(fileType); if (!mOnlyCheckSyntax)
mArguments += getLibraryArguments(fileType);
if (!fileExists(mCompiler)) { if (!fileExists(mCompiler)) {
throw CompileError(tr("The Compiler '%1' doesn't exists!").arg(mCompiler)); throw CompileError(tr("The Compiler '%1' doesn't exists!").arg(mCompiler));

View File

@ -47,7 +47,8 @@ bool StdinCompiler::prepareForCompile()
default: default:
throw CompileError(tr("Can't find the compiler for file %1").arg(mFilename)); throw CompileError(tr("Can't find the compiler for file %1").arg(mFilename));
} }
mArguments += getLibraryArguments(fileType); if (!mOnlyCheckSyntax)
mArguments += getLibraryArguments(fileType);
if (!fileExists(mCompiler)) { if (!fileExists(mCompiler)) {
throw CompileError(tr("The Compiler '%1' doesn't exists!").arg(mCompiler)); throw CompileError(tr("The Compiler '%1' doesn't exists!").arg(mCompiler));

View File

@ -991,7 +991,7 @@ void MainWindow::checkSyntaxInBack(Editor *e)
return; return;
mCheckSyntaxInBack=true; mCheckSyntaxInBack=true;
ui->tableIssues->clearIssues(); clearIssues();
CompileTarget target =getCompileTarget(); CompileTarget target =getCompileTarget();
if (target ==CompileTarget::Project) { if (target ==CompileTarget::Project) {
mCompilerManager->checkSyntax(e->filename(),e->text(), mCompilerManager->checkSyntax(e->filename(),e->text(),
@ -1024,7 +1024,7 @@ bool MainWindow::compile(bool rebuild)
if (e->inProject() && e->modified()) if (e->inProject() && e->modified())
return false; return false;
} }
ui->tableIssues->clearIssues(); clearIssues();
// Increment build number automagically // Increment build number automagically
if (mProject->options().versionInfo.autoIncBuildNr) { if (mProject->options().versionInfo.autoIncBuildNr) {
@ -1042,7 +1042,7 @@ bool MainWindow::compile(bool rebuild)
} else { } else {
Editor * editor = mEditorList->getEditor(); Editor * editor = mEditorList->getEditor();
if (editor != NULL ) { if (editor != NULL ) {
ui->tableIssues->clearIssues(); clearIssues();
if (editor->modified()) { if (editor->modified()) {
if (!editor->save(false,false)) if (!editor->save(false,false))
return false; return false;
@ -1871,7 +1871,7 @@ void MainWindow::buildContextMenus()
ui->tableIssues); ui->tableIssues);
connect(mTableIssuesClearAction,&QAction::triggered, connect(mTableIssuesClearAction,&QAction::triggered,
[this](){ [this](){
ui->tableIssues->clearIssues(); clearIssues();
}); });
//context menu signal for search view //context menu signal for search view
@ -2755,7 +2755,7 @@ void MainWindow::closeProject(bool refreshEditor)
} }
if (!mQuitting) { if (!mQuitting) {
// Clear error browser // Clear error browser
ui->tableIssues->clearIssues(); clearIssues();
updateProjectView(); updateProjectView();
} }
} }
@ -4491,6 +4491,15 @@ void MainWindow::setFilesViewRoot(const QString &path)
ui->txtFilesPath->setCursorPosition(1); ui->txtFilesPath->setCursorPosition(1);
} }
void MainWindow::clearIssues()
{
int i = ui->tabMessages->indexOf(ui->tabIssues);
if (i!=-1) {
ui->tabMessages->setTabText(i, tr("Issues"));
}
ui->tableIssues->clearIssues();
}
Ui::MainWindow *MainWindow::mainWidget() const Ui::MainWindow *MainWindow::mainWidget() const
{ {
return ui; return ui;

View File

@ -195,6 +195,7 @@ private:
void includeOrSkipDirs(const QStringList& dirs, bool skip); void includeOrSkipDirs(const QStringList& dirs, bool skip);
void showSearchReplacePanel(bool show); void showSearchReplacePanel(bool show);
void setFilesViewRoot(const QString& path); void setFilesViewRoot(const QString& path);
void clearIssues();
private slots: private slots:
void onAutoSaveTimeout(); void onAutoSaveTimeout();