forked from qt-creator/qt-creator
ExtraCompiler: Get rid of setCompileIssues()
This basically reverts 8643877c33.
The setCompileIssues() introduced there wasn't used anywhere.
Since the "issues" field is always empty, the updateIssues()
is no-op.
Change-Id: I7e7e5fc9778343fbaafc717b80188a65ba7adc39
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -10,9 +10,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
#include <texteditor/texteditor.h>
|
|
||||||
#include <texteditor/texteditorsettings.h>
|
|
||||||
#include <texteditor/fontsettings.h>
|
|
||||||
|
|
||||||
#include <utils/asynctask.h>
|
#include <utils/asynctask.h>
|
||||||
#include <utils/expected.h>
|
#include <utils/expected.h>
|
||||||
@@ -36,7 +33,6 @@ public:
|
|||||||
const Project *project;
|
const Project *project;
|
||||||
FilePath source;
|
FilePath source;
|
||||||
FileNameToContentsHash contents;
|
FileNameToContentsHash contents;
|
||||||
Tasks issues;
|
|
||||||
QDateTime compileTime;
|
QDateTime compileTime;
|
||||||
Core::IEditor *lastEditor = nullptr;
|
Core::IEditor *lastEditor = nullptr;
|
||||||
QMetaObject::Connection activeBuildConfigConnection;
|
QMetaObject::Connection activeBuildConfigConnection;
|
||||||
@@ -44,7 +40,6 @@ public:
|
|||||||
bool dirty = false;
|
bool dirty = false;
|
||||||
|
|
||||||
QTimer timer;
|
QTimer timer;
|
||||||
void updateIssues();
|
|
||||||
|
|
||||||
FutureSynchronizer m_futureSynchronizer;
|
FutureSynchronizer m_futureSynchronizer;
|
||||||
std::unique_ptr<TaskTree> m_taskTree;
|
std::unique_ptr<TaskTree> m_taskTree;
|
||||||
@@ -226,7 +221,6 @@ void ExtraCompiler::onEditorChanged(Core::IEditor *editor)
|
|||||||
|
|
||||||
if (editor && editor->document()->filePath() == d->source) {
|
if (editor && editor->document()->filePath() == d->source) {
|
||||||
d->lastEditor = editor;
|
d->lastEditor = editor;
|
||||||
d->updateIssues();
|
|
||||||
|
|
||||||
// Handle new editor
|
// Handle new editor
|
||||||
connect(d->lastEditor->document(), &Core::IDocument::contentsChanged,
|
connect(d->lastEditor->document(), &Core::IDocument::contentsChanged,
|
||||||
@@ -276,40 +270,6 @@ Environment ExtraCompiler::buildEnvironment() const
|
|||||||
return Environment::systemEnvironment();
|
return Environment::systemEnvironment();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtraCompiler::setCompileIssues(const Tasks &issues)
|
|
||||||
{
|
|
||||||
d->issues = issues;
|
|
||||||
d->updateIssues();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ExtraCompilerPrivate::updateIssues()
|
|
||||||
{
|
|
||||||
if (!lastEditor)
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto widget = qobject_cast<TextEditor::TextEditorWidget *>(lastEditor->widget());
|
|
||||||
if (!widget)
|
|
||||||
return;
|
|
||||||
|
|
||||||
QList<QTextEdit::ExtraSelection> selections;
|
|
||||||
const QTextDocument *document = widget->document();
|
|
||||||
for (const Task &issue : std::as_const(issues)) {
|
|
||||||
QTextEdit::ExtraSelection selection;
|
|
||||||
QTextCursor cursor(document->findBlockByNumber(issue.line - 1));
|
|
||||||
cursor.movePosition(QTextCursor::StartOfLine);
|
|
||||||
cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
|
|
||||||
selection.cursor = cursor;
|
|
||||||
|
|
||||||
const auto fontSettings = TextEditor::TextEditorSettings::fontSettings();
|
|
||||||
selection.format = fontSettings.toTextCharFormat(issue.type == Task::Warning ?
|
|
||||||
TextEditor::C_WARNING : TextEditor::C_ERROR);
|
|
||||||
selection.format.setToolTip(issue.description());
|
|
||||||
selections.append(selection);
|
|
||||||
}
|
|
||||||
|
|
||||||
widget->setExtraSelections(TextEditor::TextEditorWidget::CodeWarningsSelection, selections);
|
|
||||||
}
|
|
||||||
|
|
||||||
Utils::FutureSynchronizer *ExtraCompiler::futureSynchronizer() const
|
Utils::FutureSynchronizer *ExtraCompiler::futureSynchronizer() const
|
||||||
{
|
{
|
||||||
return &d->m_futureSynchronizer;
|
return &d->m_futureSynchronizer;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "projectnodes.h"
|
#include "projectnodes.h"
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
#include "task.h"
|
|
||||||
|
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
|
|
||||||
@@ -67,7 +66,6 @@ protected:
|
|||||||
void setContent(const Utils::FilePath &file, const QByteArray &content);
|
void setContent(const Utils::FilePath &file, const QByteArray &content);
|
||||||
void updateCompileTime();
|
void updateCompileTime();
|
||||||
Utils::Environment buildEnvironment() const;
|
Utils::Environment buildEnvironment() const;
|
||||||
void setCompileIssues(const Tasks &issues);
|
|
||||||
using ContentProvider = std::function<QByteArray()>;
|
using ContentProvider = std::function<QByteArray()>;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user