Sнаđошƒаӽ
Sнаđошƒаӽ

Reputation: 17562

Custom build system for QML in Sublime Text 3

I have created a build system for QML in sublime, so selecting that build system and doing a ctrl+B builds the qml code for me. But every time I switch between different type files (eg. a .py file and .qml file) I have to change the build system from QML to Automatic and vice versa. What can I do so that sublime automatically recognizes a .qml file and selects the appropriate build-system when Automatic is selected? (which for my .qml files should be the QML.sublime-build that I created)

Here is my build system for qml: (in the file "QML.sublime-build")

{
    "shell_cmd": "qmlscene.exe $file_name"
}

Upvotes: 0

Views: 1191

Answers (2)

Sнаđошƒаӽ
Sнаđошƒаӽ

Reputation: 17562

Here is a nice sublime-package for QML. This has syntax highlighting for QML and some QML snippets and more importantly, automatic build system for QML. Here is one more. Though I did not use the latter, but it says it has even more features!

Upvotes: 0

MattDMo
MattDMo

Reputation: 102852

The documentation and reference for build systems contain all the information you need. Specifically to your situation, you need a "selector" option:

{
    "cmd": ["qmlscene.exe", "$file_name"],
    "selector": "source.qml"
}

You can now select Automatic in the Build Systems menu, and hitting CtrlB will build QML files with this system, and Python files with the Python build system.

Upvotes: 2

Related Questions