diff --git a/src/plugins/haskell/haskellplugin.cpp b/src/plugins/haskell/haskellplugin.cpp index 6da003c1a50..632b9514a98 100644 --- a/src/plugins/haskell/haskellplugin.cpp +++ b/src/plugins/haskell/haskellplugin.cpp @@ -17,8 +17,6 @@ #include #include -#include -#include #include @@ -51,8 +49,8 @@ public: setupHaskellEditor(); - ProjectExplorer::ProjectManager::registerProjectType( - Constants::C_HASKELL_PROJECT_MIMETYPE); + setupHaskellProject(); + TextEditor::SnippetProvider::registerGroup(Constants::C_HASKELLSNIPPETSGROUP_ID, Tr::tr("Haskell", "SnippetProvider")); diff --git a/src/plugins/haskell/haskellproject.cpp b/src/plugins/haskell/haskellproject.cpp index f19840a67f5..01d652c49ef 100644 --- a/src/plugins/haskell/haskellproject.cpp +++ b/src/plugins/haskell/haskellproject.cpp @@ -5,14 +5,16 @@ #include "haskellconstants.h" -#include -#include - +#include #include +#include +#include +#include #include +#include #include -#include +#include #include #include @@ -21,8 +23,7 @@ using namespace ProjectExplorer; using namespace Utils; -namespace Haskell { -namespace Internal { +namespace Haskell::Internal { static QVector parseExecutableNames(const FilePath &projectFilePath) { @@ -42,18 +43,23 @@ static QVector parseExecutableNames(const FilePath &projectFilePath) return result; } -HaskellProject::HaskellProject(const Utils::FilePath &fileName) - : Project(Constants::C_HASKELL_PROJECT_MIMETYPE, fileName) +class HaskellBuildSystem final : public BuildSystem { - setId(Constants::C_HASKELL_PROJECT_ID); - setDisplayName(fileName.toFileInfo().completeBaseName()); - setBuildSystemCreator([](Target *t) { return new HaskellBuildSystem(t); }); -} +public: + HaskellBuildSystem(Target *t); -bool HaskellProject::isHaskellProject(Project *project) -{ - return project && project->id() == Constants::C_HASKELL_PROJECT_ID; -} + void triggerParsing() final; + + QString name() const final { return QLatin1String("haskell"); } + +private: + void updateApplicationTargets(); + void refresh(); + +private: + ParseGuard m_parseGuard; + TreeScanner m_scanner; +}; HaskellBuildSystem::HaskellBuildSystem(Target *t) : BuildSystem(t) @@ -108,5 +114,22 @@ void HaskellBuildSystem::updateApplicationTargets() target()->updateDefaultRunConfigurations(); } -} // namespace Internal -} // namespace Haskell +class HaskellProject final : public Project +{ +public: + explicit HaskellProject(const FilePath &fileName) + : Project(Constants::C_HASKELL_PROJECT_MIMETYPE, fileName) + { + setId(Constants::C_HASKELL_PROJECT_ID); + setDisplayName(fileName.toFileInfo().completeBaseName()); + setBuildSystemCreator([](Target *t) { return new HaskellBuildSystem(t); }); + } +}; + +void setupHaskellProject() +{ + ProjectManager::registerProjectType( + Constants::C_HASKELL_PROJECT_MIMETYPE); +} + +} // Haskell::Internal diff --git a/src/plugins/haskell/haskellproject.h b/src/plugins/haskell/haskellproject.h index 79bec049ae4..79627d9c5b0 100644 --- a/src/plugins/haskell/haskellproject.h +++ b/src/plugins/haskell/haskellproject.h @@ -3,42 +3,8 @@ #pragma once -#include -#include -#include -#include +namespace Haskell::Internal { -namespace Haskell { -namespace Internal { +void setupHaskellProject(); -class HaskellProject : public ProjectExplorer::Project -{ - Q_OBJECT - -public: - explicit HaskellProject(const Utils::FilePath &fileName); - - static bool isHaskellProject(Project *project); -}; - -class HaskellBuildSystem : public ProjectExplorer::BuildSystem -{ - Q_OBJECT - -public: - HaskellBuildSystem(ProjectExplorer::Target *t); - - void triggerParsing() override; - QString name() const final { return QLatin1String("haskell"); } - -private: - void updateApplicationTargets(); - void refresh(); - -private: - ParseGuard m_parseGuard; - ProjectExplorer::TreeScanner m_scanner; -}; - -} // namespace Internal -} // namespace Haskell +} // Haskell::Internal