[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bkdevelop=5D_languages/cpp/codecompletion=3A_run_gen?=
From: Milian Wolff <mail () milianw ! de>
Date: 2011-03-02 18:13:32
Message-ID: 20110302181332.833EDA60C9 () git ! kde ! org
[Download RAW message or body]
Git commit 68cf85a72d5e1e877d7e98aa49376e382304ea41 by Milian Wolff.
Committed on 02/03/2011 at 19:10.
Pushed by mwolff into branch 'master'.
run generated 'create definition' and 'override' code through source formatter before \
insertion
M +9 -0 languages/cpp/codecompletion/implementationhelperitem.cpp
http://commits.kde.org/kdevelop/68cf85a72d5e1e877d7e98aa49376e382304ea41
diff --git a/languages/cpp/codecompletion/implementationhelperitem.cpp \
b/languages/cpp/codecompletion/implementationhelperitem.cpp index fd29e4a..5cb4de0 \
100644
--- a/languages/cpp/codecompletion/implementationhelperitem.cpp
+++ b/languages/cpp/codecompletion/implementationhelperitem.cpp
@@ -29,6 +29,8 @@
#include <language/duchain/parsingenvironment.h>
#include <sourcemanipulation.h>
#include <cppduchain.h>
+#include <interfaces/isourceformattercontroller.h>
+#include <interfaces/isourceformatter.h>
namespace Cpp {
@@ -397,6 +399,7 @@ void ImplementationHelperItem::execute(KTextEditor::Document* \
document, const KT
lock.unlock();
+ ///TODO: format these changes as well?
if(!insertion.changes().applyAllChanges()) {
kDebug() << "failed";
return;
@@ -418,6 +421,12 @@ void ImplementationHelperItem::execute(KTextEditor::Document* \
document, const KT
rangeToReplace = KTextEditor::Range(word.start().line(), noReplace + 1, \
word.end().line(), word.end().column()); replacementText = "\n" + replacementText;
}
+
+ ISourceFormatter* formatter = \
ICore::self()->sourceFormatterController()->formatterForUrl(document->url()); + if \
(formatter) { + formatter->formatSource(replacementText, \
KMimeType::mimeType(document->mimeType())); + }
+
DocumentChangeSet changes;
changes.addChange(DocumentChange(IndexedString(document->url()), rangeToReplace, \
document->text(rangeToReplace), replacementText)); changes.applyAllChanges();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic