aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/haskell/haskellplugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/haskell/haskellplugin.cpp')
-rw-r--r--plugins/haskell/haskellplugin.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/plugins/haskell/haskellplugin.cpp b/plugins/haskell/haskellplugin.cpp
index 0aa187f..843a524 100644
--- a/plugins/haskell/haskellplugin.cpp
+++ b/plugins/haskell/haskellplugin.cpp
@@ -34,10 +34,14 @@
#include "optionspage.h"
#include "stackbuildstep.h"
+#include <coreplugin/actionmanager/actionmanager.h>
+#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
#include <projectexplorer/projectmanager.h>
#include <texteditor/snippets/snippetprovider.h>
+#include <QAction>
+
namespace Haskell {
namespace Internal {
@@ -56,6 +60,16 @@ HaskellPlugin::~HaskellPlugin()
delete d;
}
+static void registerGhciAction()
+{
+ QAction *action = new QAction(HaskellManager::tr("Run GHCi"), HaskellManager::instance());
+ Core::ActionManager::registerAction(action, Constants::A_RUN_GHCI);
+ QObject::connect(action, &QAction::triggered, HaskellManager::instance(), [] {
+ if (Core::IDocument *doc = Core::EditorManager::currentDocument())
+ HaskellManager::openGhci(doc->filePath());
+ });
+}
+
bool HaskellPlugin::initialize(const QStringList &arguments, QString *errorString)
{
Q_UNUSED(arguments)
@@ -72,6 +86,8 @@ bool HaskellPlugin::initialize(const QStringList &arguments, QString *errorStrin
HaskellManager::writeSettings(Core::ICore::settings());
});
+ registerGhciAction();
+
HaskellManager::readSettings(Core::ICore::settings());
return true;
}