aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/haskell/haskelleditorfactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/haskell/haskelleditorfactory.cpp')
-rw-r--r--plugins/haskell/haskelleditorfactory.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/plugins/haskell/haskelleditorfactory.cpp b/plugins/haskell/haskelleditorfactory.cpp
index 6570d22..be450d9 100644
--- a/plugins/haskell/haskelleditorfactory.cpp
+++ b/plugins/haskell/haskelleditorfactory.cpp
@@ -27,7 +27,9 @@
#include "haskellconstants.h"
#include "haskellhighlighter.h"
+#include "haskellmanager.h"
+#include <coreplugin/actionmanager/commandbutton.h>
#include <texteditor/textdocument.h>
#include <texteditor/texteditoractionhandler.h>
@@ -36,6 +38,18 @@
namespace Haskell {
namespace Internal {
+static QWidget *createEditorWidget()
+{
+ auto widget = new TextEditor::TextEditorWidget;
+ auto ghciButton = new Core::CommandButton(Constants::A_RUN_GHCI, widget);
+ ghciButton->setText(HaskellManager::tr("GHCi"));
+ QObject::connect(ghciButton, &QToolButton::clicked, HaskellManager::instance(), [widget] {
+ HaskellManager::openGhci(widget->textDocument()->filePath());
+ });
+ widget->insertExtraToolBarWidget(TextEditor::TextEditorWidget::Left, ghciButton);
+ return widget;
+}
+
HaskellEditorFactory::HaskellEditorFactory()
{
setId(Constants::C_HASKELLEDITOR_ID);
@@ -44,6 +58,7 @@ HaskellEditorFactory::HaskellEditorFactory()
setEditorActionHandlers(TextEditor::TextEditorActionHandler::UnCommentSelection
| TextEditor::TextEditorActionHandler::FollowSymbolUnderCursor);
setDocumentCreator([] { return new TextEditor::TextDocument(Constants::C_HASKELLEDITOR_ID); });
+ setEditorWidgetCreator(createEditorWidget);
setCommentDefinition(Utils::CommentDefinition("--", "{-", "-}"));
setParenthesesMatchingEnabled(true);
setMarksVisible(true);