HISEScript-Sublime



  • Disclaimer: I don't want to hurt anybody)) Just like sublime for many little features.

    So I've written some regexes, feeded scripting API headers to them and packed into ST completion buffer.
    Give it try: https://github.com/Levitanus/HISEScript-Sublime

    0_1543210258700_HISEScript.gif

    P.S. Hold my hand on heart, that Christoph will not change formatting of the headers))



  • Awesome work! I've put quite some effort into making HISE a somewhat decent IDE for scripting (so in Sublime you won't ever get live info like current variable values or context dependent autocompletes for method objects etc.), however there is something with Sublime Text that feels just better than any text editor I've ever worked with, so I'll definitely check it at some point. Also a big plus for calling it HISEScript - I might choose this name over "Javascript" at some point in the future to prevent false expectations.

    A few remarks:

    1. Have you added all custom "HISEScript" additions?
    
    // includes
    include("MyFile.js");
    
    // globals
    global x = 25.0;
    
    // namespaces
    namespace MyButton
    {
    
    }
    
    // local variables
    function onNoteOn()
    {
        local x = Message.getNoteNumber();
    }
    
    1. In the autocompletion in HISE you get a few function prototypes already typed out for you. For example if you type Panel.se, press Escape, choose the paint routine you will get:
    Panel1.setPaintRoutine(function(g)
    {
    	
    });
    

    Is that possible with Sublime Text (I know Visual Assist has a "Snippet" feature which allows you to automatically add boilerplate templates with shortcuts).

    1. If you press Shift + Return, you also get a semicolon at the end of the line in HISE 🙂

    PS: Oh and don't worry about the headers getting changed. The scripting API is supposed to be 100% backwards compatible - once in a while I introduce "breaking changes" like disallowing anonymous variable definitions because it's the root of 55% of all evilness), but I'll never rename Content.addKnob() to UI.addSlider() or something 🙂



  • Oh and by the way: the API documentation inside HISE is generated using the XML output from doxygen. A doxyfile that only processes the scripting API files is available here:

    HISE Root/tools/api generator/xml.doxyfile
    

    (there's also a batch script that copies the most relevant output files, which also contains some useful information).

    If you switch to parsing this output, you might be on the 100% safe side as it's the exact same way I am generating the inbuilt documentation.



  • @christoph-hart said in HISEScript-Sublime:

    Have you added all custom "HISEScript" additions?

    only namespaces, I'll add today later, thanks)
    The main problem in additions is fact, that I have been attached too much to various code formatting tools. And one night is not enough for modifying JS beautifier. Quick additions have not worked...

    What about g.methods, they are available as GraphincsObject class methods.
    And, yep, you're absolutely right, that there are not any static analyzer. Nor yet, nor in closest future. I've spent yet a half of year on one static analyzer, that nobody is using 😄

    But if methods are used after the dot, the class name is not used:
    0_1543237379672_hise-scopes.gif

    @christoph-hart said in HISEScript-Sublime:

    HISE is generated using the XML output from doxygen

    Thanks, once my regexps are broken, I'll get one more try to handle this xml))
    Shame, but I'm totally incompetent in cpp. Looked long to Your generator's code, then tried to parse headers by GCCXML, then returned to the original idea of stupid tokenization 🙂

    Resume:
    I'll maintain it for a while during tasks of the first HISE project – later will look to what can be done)



  • @christoph-hart , Can you, when you have time, provide the list of such "snippets", or, at least, of those, which are not obvious?

    I'm making some, like custom callback definition and external js mandatory callbacks, but I'm a newbie in HISE, so, definitely, will lose things.

    0_1543355620654_2018-11-28_04-52-59.png

    Also, downloaded doxygen and tried it. Cool!) But I'll get to it only when the current system broke, cause it requires to be generated on server-side, and now user can just specify hise folder...

    (isn't updated yet. maybe, closer to morning)



  • From the top of my head (with decrasing importance):

    • all ScriptPanel callbacks that accept a function as parameter. Check the autocomplete popup for this.
    • the custom callback for a UI component (you can create these already with the context menu of a UI component, but still useful for a more Sublime focused workflow)
    • script definitions (for both modules and UI components).
    • the ScriptPanel.setPopupData / FloatingTile.setContent methods which take a JSON object as argument (You can already add the default FloatingTile properties like Type and ColourData).


  • Christoph, thanks!

    updated:

    added:

    • namespaces
    • locals
    • snippets:
      • callbacks mandatory
      • callback of control
      • include
    • setting "hise_supress_completions": false
    • Math, Array, String objects now parsed from source

    changed:

    • Now syntax is copy of standart Javascript with additions to native scopes, not just added scopes.


  • hey levitanus,

    I tried to install your HISEScript Package but couldn't find the HISEScript entry in the syntax view, after making sure that the HISE path was set up right.

    btw: renaming the package-folder to HISEScriptand mentioning the specific Package Settings > HISEScript > Settings - User could also help the user in the install procedure.

    Thanks a lot for this project! Looking forward to using it.
    best, d



  • @dominik-mayer 0_1543425497540_hisescrit location.gif
    Pity, but now I can't tell more. Will try to install it from the laptop at morning and, maybe on ubuntu.
    I think it can be, from one hand too high in the folder structure, or too low. But maybe other problems. Maybe, something wrong with paths, getting by the script. But, generally, the syntax has to appear just with pasting it in the right place...



  • @dominik-mayer said in HISEScript-Sublime:

    package-folder to HISEScript

    Generally, it has to be. But I afraid of other repositories with the same name. So... I hope, when I get to package control, it will be much easier.

    @dominik-mayer said in HISEScript-Sublime:

    Package Settings > HISEScript > Settings - User

    They are mentioned in the install guide on GitHub. Or not quite? ))


 

1
Online

353
Users

1.1k
Topics

7.6k
Posts