[bug] Hydra tabs
-
@d-healey I'm on develop code from Jul 29, 2022 and I have not experienced that issue
-
I‘m experiencing this too. The reason is that opening a script file spawns a new tab so you can switch back, however this leaves this army of dead fish swimming around when you restart HISE.
I haven‘t been able to find a proper solution yet, so I‘ve added a Close other tabs function to the context menu of the tab bar.
-
@Christoph-Hart I'm glad it's not just me :)
I like to have 4 or 5 tabs open usually so closing all other tabs isn't helpful for me. What about not creating new tabs if there is already a script editor tab available?
-
@d-healey actually it should check if the file is already open and then just switch there. But I think the problem is that it resets all tabs to onInit when you restart HISE which is why they are piling up like this.
There is a good solution to this problem somewhere out there but I haven‘t found it yet :)
-
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.