The way I set up this program (and bare in mind the structure may change)
is that it remembers all the current functions with their syntax and gives it an ID.
For example:
ListOfFunctions[0] = "void OnStart()"
ListOfFunctions[1] = "void OnEnter()"
...
The index of the function is its intern ID.
When you then select a function in the UI of the program, it gets the function's ID and creates a command list for it.
ListOfFunctions[0] = "void OnStart()"
ListOfCommands[0] = "SetEntityActive("example", false); \n SetEntityActive(...)"
If a new function is created by any of the commands, it gives it a new ID and adds it to the ListOfFunctions. The function can then be accessed.
When you're ready and press the "Build script" button the .hps file compiles.
For each Function it generates the following:
ListOfFunctions[ID] ("void OnStart()")
"{"
ListOfCommands[ID] ("SetEntityActive("example", false); \n SetEntityActive(...)")
"}"
Where ID is increasing to cover all functions ready.
You end up with a structured .hps file as usual.
But you cannot preview it unless you actually build the file.
(But a feature to preview the build might be added)