forked from qt-creator/qt-creator
Nim: Pass on parse errors to issues pane
When parsing the config of a nim project we may have parser issues that might be of interest for the user. Change-Id: Iefec8194fe625110579cda8cf840e03945e677b9 Reviewed-by: Filippo Cucchetto <filippocucchetto@gmail.com> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -65,6 +65,9 @@ const QString C_NIMCOMPILERBUILDSTEP_TARGETNIMFILE = QStringLiteral("Nim.NimComp
|
||||
// NimCompilerCleanStep
|
||||
const char C_NIMCOMPILERCLEANSTEP_ID[] = "Nim.NimCompilerCleanStep";
|
||||
|
||||
// Nim task category (Issues pane)
|
||||
const char C_NIMPARSE_ID[] = "Nim.NimParse";
|
||||
|
||||
const char C_NIMLANGUAGE_ID[] = "Nim";
|
||||
const char C_NIMCODESTYLESETTINGSPAGE_ID[] = "Nim.NimCodeStyleSettings";
|
||||
const char C_NIMCODESTYLESETTINGSPAGE_DISPLAY[] = QT_TRANSLATE_NOOP("NimCodeStyleSettingsPage", "Code Style");
|
||||
|
@@ -49,6 +49,7 @@
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
#include <projectexplorer/toolchainmanager.h>
|
||||
#include <projectexplorer/runcontrol.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
#include <texteditor/snippets/snippetprovider.h>
|
||||
|
||||
using namespace Utils;
|
||||
@@ -135,6 +136,7 @@ void NimPlugin::extensionsInitialized()
|
||||
Core::FileIconProvider::registerIconOverlayForMimeType(icon, Constants::C_NIM_SCRIPT_MIMETYPE);
|
||||
Core::FileIconProvider::registerIconOverlayForMimeType(icon, Constants::C_NIMBLE_MIMETYPE);
|
||||
}
|
||||
TaskHub::addCategory(Constants::C_NIMPARSE_ID, "Nim");
|
||||
}
|
||||
|
||||
} // namespace Nim
|
||||
|
@@ -28,8 +28,10 @@
|
||||
#include "nimbuildsystem.h"
|
||||
#include "nimbleproject.h"
|
||||
#include "nimproject.h"
|
||||
#include "../nimconstants.h"
|
||||
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -60,6 +62,13 @@ static std::vector<NimbleTask> parseTasks(const QString &nimblePath, const QStri
|
||||
|
||||
std::vector<NimbleTask> result;
|
||||
|
||||
if (process.exitCode() != 0) {
|
||||
TaskHub::addTask(Task(Task::Error,
|
||||
QString::fromUtf8(process.readAllStandardOutput()),
|
||||
{}, -1, Constants::C_NIMPARSE_ID));
|
||||
return result;
|
||||
}
|
||||
|
||||
const QList<QByteArray> &lines = linesFromProcessOutput(&process);
|
||||
|
||||
for (const QByteArray &line : lines) {
|
||||
@@ -82,6 +91,12 @@ static NimbleMetadata parseMetadata(const QString &nimblePath, const QString &wo
|
||||
|
||||
NimbleMetadata result = {};
|
||||
|
||||
if (process.exitCode() != 0) {
|
||||
TaskHub::addTask(Task(Task::Error,
|
||||
QString::fromUtf8(process.readAllStandardOutput()),
|
||||
{}, -1, Constants::C_NIMPARSE_ID));
|
||||
return result;
|
||||
}
|
||||
const QList<QByteArray> &lines = linesFromProcessOutput(&process);
|
||||
|
||||
for (const QByteArray &line : lines) {
|
||||
@@ -153,6 +168,7 @@ void NimbleBuildSystem::triggerParsing()
|
||||
|
||||
void NimbleBuildSystem::updateProject()
|
||||
{
|
||||
TaskHub::clearTasks(Constants::C_NIMPARSE_ID);
|
||||
const FilePath projectDir = projectDirectory();
|
||||
const FilePath nimble = Nim::nimblePathFromKit(kit());
|
||||
|
||||
|
Reference in New Issue
Block a user