diff --git a/src/libs/utils/uncommentselection.cpp b/src/libs/utils/uncommentselection.cpp index 21a4756c504..8cc9752d8f7 100644 --- a/src/libs/utils/uncommentselection.cpp +++ b/src/libs/utils/uncommentselection.cpp @@ -34,12 +34,30 @@ using namespace Utils; CommentDefinition::CommentDefinition() : - isAfterWhiteSpaces(false), - singleLine(QLatin1String("//")), - multiLineStart(QLatin1String("/*")), - multiLineEnd(QLatin1String("*/")) + isAfterWhiteSpaces(false) {} +void CommentDefinition::setStyle(Style style) +{ + switch (style) { + case CppStyle: + singleLine = QLatin1String("//"); + multiLineStart = QLatin1String("/*"); + multiLineEnd = QLatin1String("*/"); + break; + case HashStyle: + singleLine = QLatin1String("#"); + multiLineStart.clear(); + multiLineEnd.clear(); + break; + } +} + +bool CommentDefinition::isValid() const +{ + return hasSingleLineStyle() || hasMultiLineStyle(); +} + bool CommentDefinition::hasSingleLineStyle() const { return !singleLine.isEmpty(); @@ -50,13 +68,6 @@ bool CommentDefinition::hasMultiLineStyle() const return !multiLineStart.isEmpty() && !multiLineEnd.isEmpty(); } -void CommentDefinition::clearCommentStyles() -{ - singleLine.clear(); - multiLineStart.clear(); - multiLineEnd.clear(); -} - static bool isComment(const QString &text, int index, const QString &commentType) { @@ -76,7 +87,7 @@ static bool isComment(const QString &text, int index, void Utils::unCommentSelection(QPlainTextEdit *edit, const CommentDefinition &definition) { - if (!definition.hasSingleLineStyle() && !definition.hasMultiLineStyle()) + if (!definition.isValid()) return; QTextCursor cursor = edit->textCursor(); diff --git a/src/libs/utils/uncommentselection.h b/src/libs/utils/uncommentselection.h index 14c16cc786e..f2bcc90ec31 100644 --- a/src/libs/utils/uncommentselection.h +++ b/src/libs/utils/uncommentselection.h @@ -45,11 +45,13 @@ class QTCREATOR_UTILS_EXPORT CommentDefinition public: CommentDefinition(); + enum Style { CppStyle, HashStyle }; + void setStyle(Style style); + + bool isValid() const; bool hasSingleLineStyle() const; bool hasMultiLineStyle() const; - void clearCommentStyles(); - public: bool isAfterWhiteSpaces; QString singleLine; diff --git a/src/plugins/android/javaeditor.cpp b/src/plugins/android/javaeditor.cpp index 763228fd153..daf55fd2ec6 100644 --- a/src/plugins/android/javaeditor.cpp +++ b/src/plugins/android/javaeditor.cpp @@ -55,6 +55,7 @@ JavaEditor::JavaEditor(JavaEditorWidget *editor) setContext(Core::Context(Constants::C_JAVA_EDITOR, TextEditor::Constants::C_TEXTEDITOR)); setDuplicateSupported(true); + setCommentStyle(Utils::CommentDefinition::CppStyle); } Core::IEditor *JavaEditor::duplicate() @@ -88,18 +89,9 @@ JavaEditorWidget::JavaEditorWidget(JavaEditorWidget *other) void JavaEditorWidget::ctor() { - m_commentDefinition.clearCommentStyles(); - m_commentDefinition.singleLine = QLatin1String("//"); - m_commentDefinition.multiLineStart = QLatin1String("/*"); - m_commentDefinition.multiLineEnd = QLatin1String("*/"); setAutoCompleter(new JavaAutoCompleter); } -void JavaEditorWidget::unCommentSelection() -{ - Utils::unCommentSelection(this, m_commentDefinition); -} - TextEditor::BaseTextEditor *JavaEditorWidget::createEditor() { return new JavaEditor(this); diff --git a/src/plugins/android/javaeditor.h b/src/plugins/android/javaeditor.h index 707c5e3f149..d6a9fcede64 100644 --- a/src/plugins/android/javaeditor.h +++ b/src/plugins/android/javaeditor.h @@ -59,15 +59,12 @@ public: JavaEditorWidget(QWidget *parent = 0); JavaEditorWidget(JavaEditorWidget *other); - void unCommentSelection(); - protected: TextEditor::BaseTextEditor *createEditor(); private: JavaEditorWidget(BaseTextEditorWidget *); // avoid stupidity void ctor(); - Utils::CommentDefinition m_commentDefinition; }; class JavaDocument : public TextEditor::BaseTextDocument diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp index 4772f256d1d..127c8e30794 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp @@ -62,6 +62,7 @@ CMakeEditor::CMakeEditor(CMakeEditorWidget *editor) setContext(Core::Context(CMakeProjectManager::Constants::C_CMAKEEDITOR, TextEditor::Constants::C_TEXTEDITOR)); setDuplicateSupported(true); + setCommentStyle(Utils::CommentDefinition::HashStyle); connect(document(), SIGNAL(changed()), this, SLOT(markAsChanged())); } @@ -154,32 +155,17 @@ QString CMakeEditor::contextHelpId() const CMakeEditorWidget::CMakeEditorWidget(QWidget *parent) : BaseTextEditorWidget(new CMakeDocument(), parent) -{ - ctor(); -} +{} CMakeEditorWidget::CMakeEditorWidget(CMakeEditorWidget *other) : BaseTextEditorWidget(other) -{ - ctor(); -} - -void CMakeEditorWidget::ctor() -{ - m_commentDefinition.clearCommentStyles(); - m_commentDefinition.singleLine = QLatin1Char('#'); -} +{} TextEditor::BaseTextEditor *CMakeEditorWidget::createEditor() { return new CMakeEditor(this); } -void CMakeEditorWidget::unCommentSelection() -{ - Utils::unCommentSelection(this, m_commentDefinition); -} - void CMakeEditorWidget::contextMenuEvent(QContextMenuEvent *e) { showDefaultContextMenu(e, Constants::M_CONTEXT); diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.h b/src/plugins/cmakeprojectmanager/cmakeeditor.h index 618f2103ddb..9205651f65d 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.h +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.h @@ -78,13 +78,8 @@ protected: TextEditor::BaseTextEditor *createEditor(); void contextMenuEvent(QContextMenuEvent *e); -public slots: - void unCommentSelection(); - private: CMakeEditorWidget(TextEditor::BaseTextEditorWidget *); // avoid stupidity - void ctor(); - Utils::CommentDefinition m_commentDefinition; }; class CMakeDocument : public TextEditor::BaseTextDocument diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 7d833b6e756..fb292f1bc26 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -113,6 +113,7 @@ CPPEditor::CPPEditor(CPPEditorWidget *editor) m_context.add(ProjectExplorer::Constants::LANG_CXX); m_context.add(TextEditor::Constants::C_TEXTEDITOR); setDuplicateSupported(true); + setCommentStyle(Utils::CommentDefinition::CppStyle); } Q_GLOBAL_STATIC(CppTools::SymbolFinder, symbolFinder) @@ -796,11 +797,6 @@ bool CPPEditor::open(QString *errorString, const QString &fileName, const QStrin return true; } -const Utils::CommentDefinition *CPPEditor::commentDefinition() const -{ - return &m_commentDefinition; -} - TextEditor::CompletionAssistProvider *CPPEditor::completionAssistProvider() { return CppModelManagerInterface::instance()->cppEditorSupport(this)->completionAssistProvider(); @@ -836,11 +832,6 @@ void CPPEditorWidget::applyFontSettings() semanticRehighlight(true); } -void CPPEditorWidget::unCommentSelection() -{ - Utils::unCommentSelection(this); -} - void CPPEditorWidget::slotCodeStyleSettingsChanged(const QVariant &) { CppTools::QtStyleCodeFormatter formatter; diff --git a/src/plugins/cppeditor/cppeditor.h b/src/plugins/cppeditor/cppeditor.h index 99aed4ec35a..4ab03d23f64 100644 --- a/src/plugins/cppeditor/cppeditor.h +++ b/src/plugins/cppeditor/cppeditor.h @@ -66,11 +66,7 @@ public: const QString &fileName, const QString &realFileName) QTC_OVERRIDE; - const Utils::CommentDefinition *commentDefinition() const QTC_OVERRIDE; TextEditor::CompletionAssistProvider *completionAssistProvider() QTC_OVERRIDE; - -private: - Utils::CommentDefinition m_commentDefinition; }; class CPPEditorWidget : public TextEditor::BaseTextEditorWidget @@ -105,7 +101,6 @@ public slots: void cut() QTC_OVERRIDE; void selectAll() QTC_OVERRIDE; - void unCommentSelection() QTC_OVERRIDE; void switchDeclarationDefinition(bool inNextSplit); void showPreProcessorWidget(); diff --git a/src/plugins/glsleditor/glsleditor.cpp b/src/plugins/glsleditor/glsleditor.cpp index 68ba232dcef..25cfa965b5a 100644 --- a/src/plugins/glsleditor/glsleditor.cpp +++ b/src/plugins/glsleditor/glsleditor.cpp @@ -263,11 +263,6 @@ void GLSLTextEditorWidget::createToolBar(GLSLEditorEditable *editor) editor->insertExtraToolBarWidget(TextEditor::BaseTextEditor::Left, m_outlineCombo); } -void GLSLTextEditorWidget::unCommentSelection() -{ - Utils::unCommentSelection(this); -} - void GLSLTextEditorWidget::updateDocument() { m_updateDocumentTimer->start(); diff --git a/src/plugins/glsleditor/glsleditor.h b/src/plugins/glsleditor/glsleditor.h index 831b6e7d04c..3cc4c76c824 100644 --- a/src/plugins/glsleditor/glsleditor.h +++ b/src/plugins/glsleditor/glsleditor.h @@ -90,8 +90,6 @@ public: GLSLTextEditorWidget(GLSLTextEditorWidget *other); ~GLSLTextEditorWidget(); - virtual void unCommentSelection(); - int editorRevision() const; bool isOutdated() const; diff --git a/src/plugins/glsleditor/glsleditoreditable.cpp b/src/plugins/glsleditor/glsleditoreditable.cpp index f1e34ec463d..c1919cdebbd 100644 --- a/src/plugins/glsleditor/glsleditoreditable.cpp +++ b/src/plugins/glsleditor/glsleditoreditable.cpp @@ -49,6 +49,7 @@ GLSLEditorEditable::GLSLEditorEditable(GLSLTextEditorWidget *editor) setContext(Core::Context(GLSLEditor::Constants::C_GLSLEDITOR_ID, TextEditor::Constants::C_TEXTEDITOR)); setDuplicateSupported(true); + setCommentStyle(Utils::CommentDefinition::CppStyle); } } // namespace Internal diff --git a/src/plugins/pythoneditor/pythoneditor.cpp b/src/plugins/pythoneditor/pythoneditor.cpp index f68e7c82137..34fd7e46b60 100644 --- a/src/plugins/pythoneditor/pythoneditor.cpp +++ b/src/plugins/pythoneditor/pythoneditor.cpp @@ -53,10 +53,7 @@ PythonEditor::PythonEditor(EditorWidget *editorWidget) setContext(Core::Context(Constants::C_PYTHONEDITOR_ID, TextEditor::Constants::C_TEXTEDITOR)); setDuplicateSupported(true); -} - -PythonEditor::~PythonEditor() -{ + setCommentStyle(Utils::CommentDefinition::HashStyle); } Core::IEditor *PythonEditor::duplicate() diff --git a/src/plugins/pythoneditor/pythoneditor.h b/src/plugins/pythoneditor/pythoneditor.h index 06901189025..bbbf73031cd 100644 --- a/src/plugins/pythoneditor/pythoneditor.h +++ b/src/plugins/pythoneditor/pythoneditor.h @@ -43,7 +43,6 @@ class PythonEditor : public TextEditor::BaseTextEditor public: explicit PythonEditor(EditorWidget *editorWidget); - virtual ~PythonEditor(); Core::IEditor *duplicate(); diff --git a/src/plugins/pythoneditor/pythoneditorwidget.cpp b/src/plugins/pythoneditor/pythoneditorwidget.cpp index fc69254e9e1..3968aff797f 100644 --- a/src/plugins/pythoneditor/pythoneditorwidget.cpp +++ b/src/plugins/pythoneditor/pythoneditorwidget.cpp @@ -64,10 +64,6 @@ EditorWidget::EditorWidget(EditorWidget *other) void EditorWidget::ctor() { - m_commentDefinition.multiLineStart.clear(); - m_commentDefinition.multiLineEnd.clear(); - m_commentDefinition.singleLine = QLatin1Char('#'); - setParenthesesMatchingEnabled(true); setMarksVisible(true); setCodeFoldingSupported(true); @@ -75,18 +71,6 @@ void EditorWidget::ctor() new PythonHighlighter(baseTextDocument()); } -EditorWidget::~EditorWidget() -{ -} - -/** - Comments or uncomments selection using Python commenting syntax - */ -void EditorWidget::unCommentSelection() -{ - Utils::unCommentSelection(this, m_commentDefinition); -} - TextEditor::BaseTextEditor *EditorWidget::createEditor() { return new PythonEditor(this); diff --git a/src/plugins/pythoneditor/pythoneditorwidget.h b/src/plugins/pythoneditor/pythoneditorwidget.h index f9422d23a55..d8d63bb3727 100644 --- a/src/plugins/pythoneditor/pythoneditorwidget.h +++ b/src/plugins/pythoneditor/pythoneditorwidget.h @@ -43,9 +43,6 @@ class EditorWidget : public TextEditor::BaseTextEditorWidget public: EditorWidget(QWidget *parent = 0); EditorWidget(EditorWidget *other); - virtual ~EditorWidget(); - - virtual void unCommentSelection(); protected: TextEditor::BaseTextEditor *createEditor(); @@ -53,7 +50,6 @@ protected: private: EditorWidget(TextEditor::BaseTextEditorWidget *); // avoid stupidity void ctor(); - Utils::CommentDefinition m_commentDefinition; }; } // namespace Internal diff --git a/src/plugins/qmakeprojectmanager/profileeditor.cpp b/src/plugins/qmakeprojectmanager/profileeditor.cpp index 575332e0b4b..6e246f95bd3 100644 --- a/src/plugins/qmakeprojectmanager/profileeditor.cpp +++ b/src/plugins/qmakeprojectmanager/profileeditor.cpp @@ -58,6 +58,7 @@ ProFileEditor::ProFileEditor(ProFileEditorWidget *editor) setContext(Core::Context(Constants::C_PROFILEEDITOR, TextEditor::Constants::C_TEXTEDITOR)); setDuplicateSupported(true); + setCommentStyle(Utils::CommentDefinition::HashStyle); } Core::IEditor *ProFileEditor::duplicate() @@ -79,26 +80,11 @@ TextEditor::CompletionAssistProvider *ProFileEditor::completionAssistProvider() ProFileEditorWidget::ProFileEditorWidget(QWidget *parent) : BaseTextEditorWidget(new ProFileDocument(), parent) -{ - ctor(); -} +{} ProFileEditorWidget::ProFileEditorWidget(ProFileEditorWidget *other) : BaseTextEditorWidget(other) -{ - ctor(); -} - -void ProFileEditorWidget::ctor() -{ - m_commentDefinition.clearCommentStyles(); - m_commentDefinition.singleLine = QLatin1Char('#'); -} - -void ProFileEditorWidget::unCommentSelection() -{ - Utils::unCommentSelection(this, m_commentDefinition); -} +{} static bool isValidFileNameChar(const QChar &c) { diff --git a/src/plugins/qmakeprojectmanager/profileeditor.h b/src/plugins/qmakeprojectmanager/profileeditor.h index f3695b75df5..c28c5d0aff6 100644 --- a/src/plugins/qmakeprojectmanager/profileeditor.h +++ b/src/plugins/qmakeprojectmanager/profileeditor.h @@ -59,8 +59,6 @@ public: ProFileEditorWidget(QWidget *parent = 0); ProFileEditorWidget(ProFileEditorWidget *other); - void unCommentSelection(); - protected: virtual Link findLinkAt(const QTextCursor &, bool resolveTarget = true, bool inNextSplit = false); @@ -69,8 +67,6 @@ protected: private: ProFileEditorWidget(BaseTextEditorWidget *); // avoid stupidity - void ctor(); - Utils::CommentDefinition m_commentDefinition; }; class ProFileDocument : public TextEditor::BaseTextDocument diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index 51e656203d1..dd3738a39a7 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -800,11 +800,6 @@ void QmlJSTextEditorWidget::resizeEvent(QResizeEvent *event) hideContextPane(); } -void QmlJSTextEditorWidget::unCommentSelection() -{ - Utils::unCommentSelection(this); -} - QmlJSEditorDocument *QmlJSTextEditorWidget::qmlJsEditorDocument() const { return m_qmlJsEditorDocument; diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h index 2c520a38764..9dc4e206d61 100644 --- a/src/plugins/qmljseditor/qmljseditor.h +++ b/src/plugins/qmljseditor/qmljseditor.h @@ -78,8 +78,6 @@ public: QmlJSTextEditorWidget(QmlJSTextEditorWidget *other); ~QmlJSTextEditorWidget(); - virtual void unCommentSelection(); - QmlJSEditorDocument *qmlJsEditorDocument() const; QModelIndex outlineModelIndex(); diff --git a/src/plugins/qmljseditor/qmljseditoreditable.cpp b/src/plugins/qmljseditor/qmljseditoreditable.cpp index bf66c83d26e..bd382421075 100644 --- a/src/plugins/qmljseditor/qmljseditoreditable.cpp +++ b/src/plugins/qmljseditor/qmljseditoreditable.cpp @@ -54,6 +54,7 @@ QmlJSEditor::QmlJSEditor(QmlJSTextEditorWidget *editor) m_context.add(TextEditor::Constants::C_TEXTEDITOR); m_context.add(ProjectExplorer::Constants::LANG_QMLJS); setDuplicateSupported(true); + setCommentStyle(Utils::CommentDefinition::CppStyle); } bool QmlJSEditor::isDesignModePreferred() const @@ -65,11 +66,6 @@ bool QmlJSEditor::isDesignModePreferred() const return false; } -const Utils::CommentDefinition *QmlJSEditor::commentDefinition() const -{ - return &m_commentDefinition; -} - TextEditor::CompletionAssistProvider *QmlJSEditor::completionAssistProvider() { return ExtensionSystem::PluginManager::getObject(); diff --git a/src/plugins/qmljseditor/qmljseditoreditable.h b/src/plugins/qmljseditor/qmljseditoreditable.h index d13f30669a0..d6167188d3c 100644 --- a/src/plugins/qmljseditor/qmljseditoreditable.h +++ b/src/plugins/qmljseditor/qmljseditoreditable.h @@ -50,11 +50,7 @@ public: bool open(QString *errorString, const QString &fileName, const QString &realFileName); bool isDesignModePreferred() const; - const Utils::CommentDefinition *commentDefinition() const; - TextEditor::CompletionAssistProvider *completionAssistProvider(); -private: - Utils::CommentDefinition m_commentDefinition; }; } // namespace Internal diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 0903b10605a..107da6636d1 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -197,6 +197,7 @@ public: Utils::LineColumnLabel *m_cursorPositionLabel; QAction *m_fileEncodingLabelAction; Utils::LineColumnLabel *m_fileEncodingLabel; + CommentDefinition m_commentDefinition; }; class BaseTextEditorWidgetPrivate @@ -367,7 +368,6 @@ public: QScopedPointer m_clipboardAssistProvider; bool m_isMissingSyntaxDefinition; - Utils::CommentDefinition m_commentDefinition; }; class TextEditExtraArea : public QWidget @@ -531,8 +531,6 @@ void BaseTextEditorWidgetPrivate::ctor(const QSharedPointer &d QObject::connect(&m_delayedUpdateTimer, SIGNAL(timeout()), q->viewport(), SLOT(update())); m_moveLineUndoHack = false; - - m_commentDefinition.clearCommentStyles(); } BaseTextEditorWidget::~BaseTextEditorWidget() @@ -1396,18 +1394,18 @@ void BaseTextEditorWidgetPrivate::moveLineUpDown(bool up) m_refactorOverlay->setMarkers(nonAffectedMarkers + affectedMarkers); bool shouldReindent = true; - const CommentDefinition *commentDefinition = q->editor()->commentDefinition(); - if (commentDefinition) { + const CommentDefinition &cd = q->editor()->commentDefinition(); + if (cd.isValid()) { QString trimmedText(text.trimmed()); - if (commentDefinition->hasSingleLineStyle()) { - if (trimmedText.startsWith(commentDefinition->singleLine)) + if (cd.hasSingleLineStyle()) { + if (trimmedText.startsWith(cd.singleLine)) shouldReindent = false; } - if (shouldReindent && commentDefinition->hasMultiLineStyle()) { + if (shouldReindent && cd.hasMultiLineStyle()) { // Don't have any single line comments; try multi line. - if (trimmedText.startsWith(commentDefinition->multiLineStart) - && trimmedText.endsWith(commentDefinition->multiLineEnd)) { + if (trimmedText.startsWith(cd.multiLineStart) + && trimmedText.endsWith(cd.multiLineEnd)) { shouldReindent = false; } } @@ -5883,7 +5881,7 @@ void BaseTextEditorWidget::rewrapParagraph() void BaseTextEditorWidget::unCommentSelection() { - Utils::unCommentSelection(this, d->m_commentDefinition); + Utils::unCommentSelection(this, editor()->commentDefinition()); } void BaseTextEditorWidget::showEvent(QShowEvent* e) @@ -6577,9 +6575,14 @@ void BaseTextEditor::select(int toPos) d->m_editorWidget->setTextCursor(tc); } -const CommentDefinition *BaseTextEditor::commentDefinition() const +CommentDefinition &BaseTextEditor::commentDefinition() const { - return 0; + return d->m_commentDefinition; +} + +void BaseTextEditor::setCommentStyle(CommentDefinition::Style style) +{ + d->m_commentDefinition.setStyle(style); } CompletionAssistProvider *BaseTextEditor::completionAssistProvider() @@ -6987,10 +6990,11 @@ void BaseTextEditorWidget::configureMimeType(const MimeType &mimeType) const QSharedPointer &definition = Manager::instance()->definition(definitionId); if (!definition.isNull() && definition->isValid()) { - d->m_commentDefinition.isAfterWhiteSpaces = definition->isCommentAfterWhiteSpaces(); - d->m_commentDefinition.singleLine = definition->singleLineComment(); - d->m_commentDefinition.multiLineStart = definition->multiLineCommentStart(); - d->m_commentDefinition.multiLineEnd = definition->multiLineCommentEnd(); + CommentDefinition &cd = editor()->commentDefinition(); + cd.isAfterWhiteSpaces = definition->isCommentAfterWhiteSpaces(); + cd.singleLine = definition->singleLineComment(); + cd.multiLineStart = definition->multiLineCommentStart(); + cd.multiLineEnd = definition->multiLineCommentEnd(); setCodeFoldingSupported(true); } diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h index 741d7e753ee..a0fd346ca40 100644 --- a/src/plugins/texteditor/basetexteditor.h +++ b/src/plugins/texteditor/basetexteditor.h @@ -39,6 +39,8 @@ #include #include +#include + #include QT_BEGIN_NAMESPACE @@ -53,11 +55,6 @@ QT_END_NAMESPACE namespace Core { class MimeType; } -namespace Utils { -class CommentDefinition; -class LineColumnLabel; -} - namespace TextEditor { class TabSettings; @@ -183,7 +180,10 @@ public: /*! Selects text between current cursor position and \a toPos. */ virtual void select(int toPos); - virtual const Utils::CommentDefinition *commentDefinition() const; + /*! Full access to comment definition, */ + Utils::CommentDefinition &commentDefinition() const; + /*! Convenience style setter. */ + void setCommentStyle(Utils::CommentDefinition::Style style); virtual CompletionAssistProvider *completionAssistProvider();