summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@theqtcompany.com>2015-08-24 18:26:09 +0200
committerNikolai Kosjar <nikolai.kosjar@theqtcompany.com>2015-09-29 11:39:21 +0000
commita7928b4b0b4c283f50c485da305582aad73afcfc (patch)
treeb33c88442f551762c598a93acabfbbe97774cc35 /src/plugins/cpptools
parentde6d7f06175be22820e7e767acf410ec1ed46fe9 (diff)
downloadqt-creator-a7928b4b0b4c283f50c485da305582aad73afcfc.tar.gz
Clang: Integrate clang's fixits as refactoring actions
They are invokable by the usual means (Alt+Enter, editor's context menu > Refactor) plus by the context menu of the editor's left margin for the related line. The fixit text comes directly from libclang and is thus not translated. We modify the text slighty by stripping the diagnostic category prefix ("note:", "error:", ...) and capitalizing the first letter. A follow-up change should properly indicate available refactorings with a refactoring icon in the editor's left margin. Task-number: QTCREATORBUG-14868 Change-Id: I86157c9f824d2a9dedf19087476d02ad1e6cc854 Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
Diffstat (limited to 'src/plugins/cpptools')
-rw-r--r--src/plugins/cpptools/baseeditordocumentprocessor.cpp6
-rw-r--r--src/plugins/cpptools/baseeditordocumentprocessor.h5
2 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/cpptools/baseeditordocumentprocessor.cpp b/src/plugins/cpptools/baseeditordocumentprocessor.cpp
index ec1a9a9617..43f5fb9029 100644
--- a/src/plugins/cpptools/baseeditordocumentprocessor.cpp
+++ b/src/plugins/cpptools/baseeditordocumentprocessor.cpp
@@ -64,6 +64,12 @@ TextEditor::TextDocument *BaseEditorDocumentProcessor::baseTextDocument() const
return m_baseTextDocument;
}
+TextEditor::QuickFixOperations
+BaseEditorDocumentProcessor::extraRefactoringOperations(const TextEditor::AssistInterface &)
+{
+ return TextEditor::QuickFixOperations();
+}
+
BaseEditorDocumentProcessor *BaseEditorDocumentProcessor::get(const QString &filePath)
{
CppModelManager *cmmi = CppModelManager::instance();
diff --git a/src/plugins/cpptools/baseeditordocumentprocessor.h b/src/plugins/cpptools/baseeditordocumentprocessor.h
index 59216d2f0c..19e7566659 100644
--- a/src/plugins/cpptools/baseeditordocumentprocessor.h
+++ b/src/plugins/cpptools/baseeditordocumentprocessor.h
@@ -35,8 +35,10 @@
#include "cppsemanticinfo.h"
#include "cpptools_global.h"
+#include <texteditor/codeassist/assistinterface.h>
#include <texteditor/texteditor.h>
#include <texteditor/textdocument.h>
+#include <texteditor/quickfix.h>
#include <cplusplus/CppDocument.h>
@@ -65,6 +67,9 @@ public:
virtual BaseEditorDocumentParser::Ptr parser() = 0;
virtual bool isParserRunning() const = 0;
+ virtual TextEditor::QuickFixOperations
+ extraRefactoringOperations(const TextEditor::AssistInterface &assistInterface);
+
public:
static BaseEditorDocumentProcessor *get(const QString &filePath);