[bug] Hydra tabs
-
I have an idea.
Never automatically create a tab unless there are no tabs.
Don't allow me to remove a tab if there is only one tab.
When clicking the module button to open a script always use the first tab. -
-
Coming back to this fully motivated in order to win the battle against the hydra tabs once for all for generations to come so that our children can live in... you get the idea.
I think the problem is that the initial workflow idea of opening new tabs is a good one (for a industry standard IDE experience I'll probably need to make this undoable though so you can jump back from wherever you came from), however it clashes with the way how HISE is currently handling external file references. Now instead of rolling back this addition and giving in to the monster of hydra tabs I'll try to sketch out a possible solution with a few follow up problems so feel free to chime in if you find a flaw.
Main Problem:
External script files are stored via index (order of inclusion of the currently connected script processor) and only referenced when included. If a new patch is loaded (at startup) which doesn't include the previous scripts, everything defaults to onInit => hydra tabs fighting against The Awesome Human.
=> Solution: save the scriptPath alongside the index, then load the file instead of the index if it's not referenced and the index can't be found
Follow-up Problem 1: if unreferenced files do not have a index connection, the combobox shows up as unconnected and it opens a new tab at jump to location
=> Solution: show them in red until they have been connected properly (to indicate that the file is actually not included in the compilation) and which each recompile check if the files are referenced now, then set the index. Meanwhile when jumping to a location, also take unreferenced script files into account.
Follow-up Problem 2: unreferenced files will be included in export - any file that is loaded into a popup editor is added to a list of files to include at export.
=> Solution: add a counter that checks how many times a file is referenced and skip the ones that aren't referenced
Follow-up Problem 3: When you switch a project, it needs to rebuild all tabs to a previous set for the given project.
=> Solution: store a .xml file (probably in the AppData folder of HISE instead of the project folder) that contains all given script tabs for a project, then reload that when you switch projects).
-
Oh and that would drive-by solve the issue of external file references getting lost when a compile error occurs, which is also very annoying.
-
I've pushed a few commits to the
hydra_season_finale
branch which kind of implements this workflow. I've also vastly improved the jump-to-definition function, it should now work reliable with all symbol definitions in all namespaces (except for local variables). -
@Christoph-Hart Excellent, thank you! I look forward to trying it.
-
Trying this out now. First thing I notice, after I close HISE and reopen it (but before I load my XML) I'm seeing the last script (.js) I had open in the script editor.
Perhaps when opening a new instance of HISE all tabs should be cleared.
-
@d-healey nooooooo! That‘s not even a bug, that‘s the entire feature I was working on for days!!!
-
@Christoph-Hart Oh, I don't get it :) Why do we need to see the last file we had open before we've loaded a project's xml?
-
@d-healey That's usually how all IDE's I work with do it. Visual Studio, Xcode, Sublime Text - they all keep the edited files open when reopening the app.
It doesn't really matter what you see before you load the XML - but if you load it I want it to show the same files as last time.
-
@Christoph-Hart Does Visual Studio open the last file even when no solution is open?
-
@d-healey No, it shows you a dialog where you can select which project to open, but let's not go down that road :)
-
@Christoph-Hart In that case I think the current implementation is fine :)
-
I don't think we have yet fully cured the problem.
I haven't narrowed down exactly what's causing this but I think it's something to do with switching between multiple projects.
-
Yes, I think I'll give up and do it like you said (remove all tabs on startup).
All praise to our new Hydra tabs overlord.
-
@Christoph-Hart I like having 4 or 5 tabs ready to go, I just don't want HISE creating more.
-
This gets weirder, I was working on a project with a bunch of tabs open, I switched to another project which only had 1 tab, when I went back to my previous project I now only have 1 tab there too.
-
@d-healey I just had 35 tabs open on my project :beaming_face_with_smiling_eyes:
-
@Dan-Korneff Good luck!
-
OK, next attempt:
- HISE will remove all tabs in the code editor tabs on app close.
- HISE will add editors to this tab if needed. So if you goto a script processor workspace and the code tabs doesn't have a HiseScript code editor, it will add one. If you select a SNEX node to be edited and the code tabs doesn't have a SNEX editor, it will add one. If you select a Faust file to be edited and the code tabs doesn't have a Faust editor, it will add one. I think this is the solution with the best UX and the days of having to add code editors of any type manually should be finally gone.
- The only exception to Rule 1 is that HISE will not remove tabs which are a container. So if you have any tab that you don't want to be closed by HISE on shutdown (eg. a server controller or OSC logger), you have to put it in a container (vertical or horizontal tile) so that it survives the tab massacre when the sun sets on the HISE app and the hydra tabs starts crawling out of the darkness.
I've also changed the X1/X2 buttons to work with goto undo / redo, fixed the Ctrl+Backspace shortcut not working on Windows and other minor things related to code navigation.