aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2021-08-18 16:43:43 +0200
committerEike Ziller <eike.ziller@qt.io>2021-08-18 14:46:06 +0000
commit3425b38d4418b5c227d4c76bf11dc3abbd793ae3 (patch)
treee0c5c2731629d85baa2d69154e1ccb20ff2d3d84 /plugins
parent91e0e3b5fb8b6cb40b2368ec16fde5442c73a473 (diff)
Add simple wizard for creating a Haskell source/module file
Change-Id: Ieae69f981747af4fbf36919abc9604d8e190f207 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/haskell/CMakeLists.txt8
-rw-r--r--plugins/haskell/haskellplugin.cpp3
-rw-r--r--plugins/haskell/share/wizards/module/file.hs1
-rw-r--r--plugins/haskell/share/wizards/module/wizard.json42
4 files changed, 54 insertions, 0 deletions
diff --git a/plugins/haskell/CMakeLists.txt b/plugins/haskell/CMakeLists.txt
index 1b5ec8f..8a9a68f 100644
--- a/plugins/haskell/CMakeLists.txt
+++ b/plugins/haskell/CMakeLists.txt
@@ -20,3 +20,11 @@ add_qtc_plugin(Haskell
optionspage.cpp optionspage.h
stackbuildstep.cpp stackbuildstep.h
)
+
+qtc_add_resources(Haskell haskell_wizards
+ PREFIX "/haskell"
+ BASE share/wizards
+ FILES
+ module/file.hs
+ module/wizard.json
+)
diff --git a/plugins/haskell/haskellplugin.cpp b/plugins/haskell/haskellplugin.cpp
index 843a524..e917116 100644
--- a/plugins/haskell/haskellplugin.cpp
+++ b/plugins/haskell/haskellplugin.cpp
@@ -38,6 +38,7 @@
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
#include <projectexplorer/projectmanager.h>
+#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
#include <texteditor/snippets/snippetprovider.h>
#include <QAction>
@@ -89,6 +90,8 @@ bool HaskellPlugin::initialize(const QStringList &arguments, QString *errorStrin
registerGhciAction();
HaskellManager::readSettings(Core::ICore::settings());
+
+ ProjectExplorer::JsonWizardFactory::addWizardPath(":/haskell/share/wizards/");
return true;
}
diff --git a/plugins/haskell/share/wizards/module/file.hs b/plugins/haskell/share/wizards/module/file.hs
new file mode 100644
index 0000000..e3f85b3
--- /dev/null
+++ b/plugins/haskell/share/wizards/module/file.hs
@@ -0,0 +1 @@
+module %{BaseName} where
diff --git a/plugins/haskell/share/wizards/module/wizard.json b/plugins/haskell/share/wizards/module/wizard.json
new file mode 100644
index 0000000..37f6ebf
--- /dev/null
+++ b/plugins/haskell/share/wizards/module/wizard.json
@@ -0,0 +1,42 @@
+{
+ "version": 1,
+ "supportedProjectTypes": [ ],
+ "id": "C.Module",
+ "category": "S.Haskell",
+ "trDescription": "Creates a Haskell module.",
+ "trDisplayName": "Module",
+ "trDisplayCategory": "Haskell",
+ "iconText": "hs",
+ "enabled": "%{JS: value('Plugins').indexOf('Haskell') >= 0}",
+
+ "options": [
+ { "key": "FileName", "value": "%{JS: Util.fileName(value('TargetPath'), 'hs')}" },
+ { "key": "BaseName", "value": "%{JS: Util.baseName(value('FileName'))}" }
+ ],
+
+ "pages" :
+ [
+ {
+ "trDisplayName": "Location",
+ "trShortTitle": "Location",
+ "typeId": "File"
+ },
+ {
+ "trDisplayName": "Project Management",
+ "trShortTitle": "Summary",
+ "typeId": "Summary"
+ }
+ ],
+ "generators" :
+ [
+ {
+ "typeId": "File",
+ "data":
+ {
+ "source": "file.hs",
+ "target": "%{FileName}",
+ "openInEditor": true
+ }
+ }
+ ]
+}