forked from qt-creator/qt-creator
Nim: Added support for nim script files
Added a new entry inside the "New" menu for creating a new nim script file (*.nims) Added support for editing them inside the editor Change-Id: I09a514fdd4e4a0e9a78bb557db3e8c7e97683b8d Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
committed by
Alessandro Portale
parent
8fce605913
commit
1a1cf3c12b
@@ -0,0 +1 @@
|
|||||||
|
echo "Hello World"
|
BIN
share/qtcreator/templates/wizards/files/nimscript/icon.png
Normal file
BIN
share/qtcreator/templates/wizards/files/nimscript/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@@ -12,4 +12,10 @@
|
|||||||
<comment>Nim source file </comment>
|
<comment>Nim source file </comment>
|
||||||
<glob pattern="*.nim"/>
|
<glob pattern="*.nim"/>
|
||||||
</mime-type>
|
</mime-type>
|
||||||
|
|
||||||
|
<mime-type type="text/x-nim-script">
|
||||||
|
<sub-class-of type="text/plain"/>
|
||||||
|
<comment>Nim script file </comment>
|
||||||
|
<glob pattern="*.nims"/>
|
||||||
|
</mime-type>
|
||||||
</mime-info>
|
</mime-info>
|
||||||
|
@@ -45,6 +45,7 @@ NimEditorFactory::NimEditorFactory()
|
|||||||
setId(Constants::C_NIMEDITOR_ID);
|
setId(Constants::C_NIMEDITOR_ID);
|
||||||
setDisplayName(tr(Nim::Constants::C_EDITOR_DISPLAY_NAME));
|
setDisplayName(tr(Nim::Constants::C_EDITOR_DISPLAY_NAME));
|
||||||
addMimeType(QLatin1String(Nim::Constants::C_NIM_MIMETYPE));
|
addMimeType(QLatin1String(Nim::Constants::C_NIM_MIMETYPE));
|
||||||
|
addMimeType(QLatin1String(Nim::Constants::C_NIM_SCRIPT_MIMETYPE));
|
||||||
|
|
||||||
setEditorActionHandlers(TextEditorActionHandler::Format
|
setEditorActionHandlers(TextEditorActionHandler::Format
|
||||||
| TextEditorActionHandler::UnCommentSelection
|
| TextEditorActionHandler::UnCommentSelection
|
||||||
|
@@ -104,6 +104,7 @@ const char C_NIMCODESTYLEPREVIEWSNIPPET[] =
|
|||||||
* MIME type
|
* MIME type
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
const char C_NIM_MIMETYPE[] = "text/x-nim";
|
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_MIME_ICON[] = "text-x-nim";
|
||||||
const char C_NIM_PROJECT_MIMETYPE[] = "text/x-nim-project";
|
const char C_NIM_PROJECT_MIMETYPE[] = "text/x-nim-project";
|
||||||
|
|
||||||
|
@@ -81,8 +81,10 @@ bool NimPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
|||||||
|
|
||||||
// Add MIME overlay icons (these icons displayed at Project dock panel)
|
// Add MIME overlay icons (these icons displayed at Project dock panel)
|
||||||
const QIcon icon((QLatin1String(Constants::C_NIM_ICON_PATH)));
|
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_MIMETYPE);
|
||||||
|
Core::FileIconProvider::registerIconOverlayForMimeType(icon, Constants::C_NIM_SCRIPT_MIMETYPE);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -80,6 +80,7 @@ NimSettings::NimSettings(QObject *parent)
|
|||||||
m_globalCodeStyle->fromSettings(QLatin1String(Nim::Constants::C_NIMLANGUAGE_ID), s);
|
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_MIMETYPE, Nim::Constants::C_NIMLANGUAGE_ID);
|
||||||
|
TextEditorSettings::registerMimeTypeForLanguageId(Nim::Constants::C_NIM_SCRIPT_MIMETYPE, Nim::Constants::C_NIMLANGUAGE_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
NimSettings::~NimSettings()
|
NimSettings::~NimSettings()
|
||||||
|
Reference in New Issue
Block a user