Clang: Indicate available "fix its" with a light bulb

...at the end of the line, just like for the "Apply Function Signature
Changes" refactor action.

* Hovering the light bulb shows the tooltip "Inspect available fixits".
* Clicking the light bulb leads to the refactoring menu, as if the user
  hit Alt+Return.

Change-Id: Iaf7b3734c43e21fc28e6b0658f517d98858c0e0c
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
This commit is contained in:
Nikolai Kosjar
2016-02-05 15:16:02 +01:00
parent cd94f66af0
commit 89199b519b
9 changed files with 132 additions and 7 deletions

View File

@@ -28,9 +28,12 @@
#include "clangtextmark.h"
#include <texteditor/refactoroverlay.h>
#include <clangbackendipc/diagnosticcontainer.h>
#include <QList>
#include <QSet>
#include <QTextEdit>
#include <QVector>
@@ -50,6 +53,7 @@ public:
const QVector<ClangBackEnd::DiagnosticContainer> &diagnosticsWithFixIts() const;
QList<QTextEdit::ExtraSelection> takeExtraSelections();
TextEditor::RefactorMarkers takeFixItAvailableMarkers();
bool hasDiagnosticsAt(uint line, uint column) const;
QVector<ClangBackEnd::DiagnosticContainer> diagnosticsAt(uint line, uint column) const;
@@ -61,7 +65,10 @@ private:
void filterDiagnostics(const QVector<ClangBackEnd::DiagnosticContainer> &diagnostics);
void generateEditorSelections();
void generateTextMarks();
void generateFixItAvailableMarkers();
void addClangTextMarks(const QVector<ClangBackEnd::DiagnosticContainer> &diagnostics);
void addFixItAvailableMarker(const QVector<ClangBackEnd::DiagnosticContainer> &diagnostics,
QSet<int> &lineNumbersWithFixItMarker);
private:
TextEditor::TextDocument *m_textDocument;
@@ -70,6 +77,7 @@ private:
QVector<ClangBackEnd::DiagnosticContainer> m_errorDiagnostics;
QVector<ClangBackEnd::DiagnosticContainer> m_fixItdiagnostics;
QList<QTextEdit::ExtraSelection> m_extraSelections;
TextEditor::RefactorMarkers m_fixItAvailableMarkers;
std::vector<ClangTextMark> m_clangTextMarks;
};