diff --git a/share/qtcreator/templates/wizards/files/nimscript/file.nims b/share/qtcreator/templates/wizards/files/nimscript/file.nims new file mode 100644 index 00000000000..73b2eaf3881 --- /dev/null +++ b/share/qtcreator/templates/wizards/files/nimscript/file.nims @@ -0,0 +1 @@ + echo "Hello World" diff --git a/share/qtcreator/templates/wizards/files/nimscript/icon.png b/share/qtcreator/templates/wizards/files/nimscript/icon.png new file mode 100644 index 00000000000..a08e474e6dc Binary files /dev/null and b/share/qtcreator/templates/wizards/files/nimscript/icon.png differ diff --git a/share/qtcreator/templates/wizards/files/nimscript/wizard.json b/share/qtcreator/templates/wizards/files/nimscript/wizard.json new file mode 100644 index 00000000000..1b0233f7540 --- /dev/null +++ b/share/qtcreator/templates/wizards/files/nimscript/wizard.json @@ -0,0 +1,37 @@ +{ + "version": 1, + "kind": "file", + "id": "Z.NimScript", + "category": "Z.Nim", + "trDescription": "Creates an empty Nim script file using UTF-8 charset.", + "trDisplayName": "Nim Script File", + "trDisplayCategory": "Nim", + "icon": "icon.png", + "enabled": "%{JS: [ %{Plugins} ].indexOf('Nim') >= 0}", + + "pages" : + [ + { + "trDisplayName": "Location", + "trShortTitle": "Location", + "typeId": "File" + }, + { + "trDisplayName": "Project Management", + "trShortTitle": "Summary", + "typeId": "Summary" + } + ], + "generators" : + [ + { + "typeId": "File", + "data": + { + "source": "file.nims", + "target": "%{JS: Util.fileName('%{TargetPath}', 'nims')}", + "openInEditor": true + } + } + ] +} diff --git a/src/plugins/nim/Nim.mimetypes.xml b/src/plugins/nim/Nim.mimetypes.xml index 3e06d398fd8..f7e94aa3dd4 100644 --- a/src/plugins/nim/Nim.mimetypes.xml +++ b/src/plugins/nim/Nim.mimetypes.xml @@ -12,4 +12,10 @@ Nim source file + + + + Nim script file + + diff --git a/src/plugins/nim/editor/nimeditorfactory.cpp b/src/plugins/nim/editor/nimeditorfactory.cpp index 32e23d0eeb4..8e733b2adb3 100644 --- a/src/plugins/nim/editor/nimeditorfactory.cpp +++ b/src/plugins/nim/editor/nimeditorfactory.cpp @@ -45,6 +45,7 @@ NimEditorFactory::NimEditorFactory() setId(Constants::C_NIMEDITOR_ID); setDisplayName(tr(Nim::Constants::C_EDITOR_DISPLAY_NAME)); addMimeType(QLatin1String(Nim::Constants::C_NIM_MIMETYPE)); + addMimeType(QLatin1String(Nim::Constants::C_NIM_SCRIPT_MIMETYPE)); setEditorActionHandlers(TextEditorActionHandler::Format | TextEditorActionHandler::UnCommentSelection diff --git a/src/plugins/nim/nimconstants.h b/src/plugins/nim/nimconstants.h index 7f2dc90d8ef..65fbeb611f3 100644 --- a/src/plugins/nim/nimconstants.h +++ b/src/plugins/nim/nimconstants.h @@ -104,6 +104,7 @@ const char C_NIMCODESTYLEPREVIEWSNIPPET[] = * MIME type ******************************************************************************/ const char C_NIM_MIMETYPE[] = "text/x-nim"; +const char C_NIM_SCRIPT_MIMETYPE[] = "text/x-nim-script"; const char C_NIM_MIME_ICON[] = "text-x-nim"; const char C_NIM_PROJECT_MIMETYPE[] = "text/x-nim-project"; diff --git a/src/plugins/nim/nimplugin.cpp b/src/plugins/nim/nimplugin.cpp index b89676e0eb6..98760d7b6e0 100644 --- a/src/plugins/nim/nimplugin.cpp +++ b/src/plugins/nim/nimplugin.cpp @@ -81,8 +81,10 @@ bool NimPlugin::initialize(const QStringList &arguments, QString *errorMessage) // Add MIME overlay icons (these icons displayed at Project dock panel) const QIcon icon((QLatin1String(Constants::C_NIM_ICON_PATH))); - if (!icon.isNull()) + if (!icon.isNull()) { Core::FileIconProvider::registerIconOverlayForMimeType(icon, Constants::C_NIM_MIMETYPE); + Core::FileIconProvider::registerIconOverlayForMimeType(icon, Constants::C_NIM_SCRIPT_MIMETYPE); + } return true; } diff --git a/src/plugins/nim/settings/nimsettings.cpp b/src/plugins/nim/settings/nimsettings.cpp index 40ac7b74a2f..cd43df48490 100644 --- a/src/plugins/nim/settings/nimsettings.cpp +++ b/src/plugins/nim/settings/nimsettings.cpp @@ -80,6 +80,7 @@ NimSettings::NimSettings(QObject *parent) m_globalCodeStyle->fromSettings(QLatin1String(Nim::Constants::C_NIMLANGUAGE_ID), s); TextEditorSettings::registerMimeTypeForLanguageId(Nim::Constants::C_NIM_MIMETYPE, Nim::Constants::C_NIMLANGUAGE_ID); + TextEditorSettings::registerMimeTypeForLanguageId(Nim::Constants::C_NIM_SCRIPT_MIMETYPE, Nim::Constants::C_NIMLANGUAGE_ID); } NimSettings::~NimSettings()