// Copyright (c) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "haskellplugin.h" #include "haskellbuildconfiguration.h" #include "haskellconstants.h" #include "haskelleditorfactory.h" #include "haskellmanager.h" #include "haskellproject.h" #include "haskellrunconfiguration.h" #include "haskellsettings.h" #include "haskelltr.h" #include "stackbuildstep.h" #include #include #include #include #include #include #include namespace Haskell { namespace Internal { class HaskellPluginPrivate { public: HaskellSettings settings; HaskellEditorFactory editorFactory; HaskellBuildConfigurationFactory buildConfigFactory; StackBuildStepFactory stackBuildStepFactory; HaskellRunConfigurationFactory runConfigFactory; ProjectExplorer::SimpleTargetRunnerFactory runWorkerFactory{{Constants::C_HASKELL_RUNCONFIG_ID}}; }; HaskellPlugin::~HaskellPlugin() { delete d; } static void registerGhciAction(QObject *guard) { QAction *action = new QAction(Tr::tr("Run GHCi"), guard); Core::ActionManager::registerAction(action, Constants::A_RUN_GHCI); QObject::connect(action, &QAction::triggered, guard, [] { if (Core::IDocument *doc = Core::EditorManager::currentDocument()) HaskellManager::openGhci(doc->filePath()); }); } bool HaskellPlugin::initialize(const QStringList &arguments, QString *errorString) { Q_UNUSED(arguments) Q_UNUSED(errorString) d = new HaskellPluginPrivate; ProjectExplorer::ProjectManager::registerProjectType( Constants::C_HASKELL_PROJECT_MIMETYPE); TextEditor::SnippetProvider::registerGroup(Constants::C_HASKELLSNIPPETSGROUP_ID, Tr::tr("Haskell", "SnippetProvider")); registerGhciAction(this); ProjectExplorer::JsonWizardFactory::addWizardPath(":/haskell/share/wizards/"); return true; } } // namespace Internal } // namespace Haskell