HISE Logo Forum
    • Categories
    • Register
    • Login

    Coding in VS Code and HISE

    Scheduled Pinned Locked Moved Scripting
    20 Posts 7 Posters 760 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • VirtualVirginV
      VirtualVirgin
      last edited by

      I am having issues that when I edit .js include files in VS Code, then hit "compile" in HISE, the .js files sometimes revert their changes, and I'm guessing this is from some cached version of the file in HISE which takes precedence. Is there some way to avoid this problem? Is there a setting to change or a workflow to adopt that will keep the changes made to the .js in VS Code?

      You can listen to my orchestral mockups here:
      https://www.virtualvirgin.net/

      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @VirtualVirgin
        last edited by d.healey

        @VirtualVirgin When you click compile in HISE (or press F5), HISE will save the contents of the code editor to the file.

        When you edit a file outside of HISE, HISE does not see the changes until you close and reopen the project. It doesn't watch for changes made externally.

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        VirtualVirginV Dan KorneffD dannytaurusD 3 Replies Last reply Reply Quote 0
        • VirtualVirginV
          VirtualVirgin @d.healey
          last edited by

          @d-healey I'm finding that HISE sometimes does take the changes made in VS Code at other times not. At this point in time I have not figured out the conditions which cause this however. I would like to continue editing in VS Code and then check out the changes by compiling in HISE. Seems kind of silly to cut and paste the entire script over to HISE no?

          You can listen to my orchestral mockups here:
          https://www.virtualvirgin.net/

          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @VirtualVirgin
            last edited by

            @VirtualVirgin said in Coding in VS Code and HISE:

            Seems kind of silly to cut and paste the entire script over to HISE no?

            alt text

            HISE is really designed with the intention that you use its own editor.

            Free HISE Bootcamp Full Course for beginners.
            YouTube Channel - Public HISE tutorials
            My Patreon - HISE tutorials

            Oli UllmannO 1 Reply Last reply Reply Quote 4
            • Oli UllmannO
              Oli Ullmann @d.healey
              last edited by

              @d-healey
              😂

              1 Reply Last reply Reply Quote 0
              • Dan KorneffD
                Dan Korneff @d.healey
                last edited by

                @d-healey actually, I think it checks for updated scripts every 3 seconds or something like that.
                I'm editing in VS code as well and sometimes see this happen.
                I can't go back to the internal editor unless it integrates CoPilot.

                Dan Korneff - Producer / Mixer / Audio Nerd

                d.healeyD 1 Reply Last reply Reply Quote 1
                • d.healeyD
                  d.healey @Dan Korneff
                  last edited by

                  @Dan-Korneff said in Coding in VS Code and HISE:

                  I think it checks for updated scripts every 3 seconds or something like that.

                  Last time I looked into it there wasn't one, but maybe Christoph added it

                  Free HISE Bootcamp Full Course for beginners.
                  YouTube Channel - Public HISE tutorials
                  My Patreon - HISE tutorials

                  1 Reply Last reply Reply Quote 0
                  • dannytaurusD
                    dannytaurus @d.healey
                    last edited by

                    @d-healey said in Coding in VS Code and HISE:

                    When you click compile in HISE (or press F5), HISE will save the contents of the code editor to the file.

                    Does this mean if a file is open in the HISE editor and you hit Compile, it will save over any changes you've made to the same file in an external editor?

                    Meat Beats: https://meatbeats.com
                    Klippr Video: https://klippr.video

                    d.healeyD 1 Reply Last reply Reply Quote 0
                    • d.healeyD
                      d.healey @dannytaurus
                      last edited by

                      @dannytaurus Yes

                      Free HISE Bootcamp Full Course for beginners.
                      YouTube Channel - Public HISE tutorials
                      My Patreon - HISE tutorials

                      1 Reply Last reply Reply Quote 0
                      • VirtualVirginV
                        VirtualVirgin
                        last edited by

                        Well, so far I have found that if I do not open the included .js file in a tab inside HISE, it seems I can work on changes inside VS Code and they will be retained when I compile in HISE. I don't know much about the caching system, so I can't guarantee this will continue to work, or work inside other environments. I am keeping a backup copy of the changes at every step at the moment just to keep an eye on it.

                        You can listen to my orchestral mockups here:
                        https://www.virtualvirgin.net/

                        Christoph HartC 1 Reply Last reply Reply Quote 1
                        • Christoph HartC
                          Christoph Hart @VirtualVirgin
                          last edited by

                          If that is a popular request I can add a "external code editor mode" that can be enabled in the HISE compiler settings and will create file watchers with automatic file reload & recompilation.

                          Let's talk pitfalls before I do that so we don't end up with something that trashes your code files:

                          • should we make external files read only in the HISE code editor if this mode is enabled? Since the "source of truth" will switch in this mode to the actual file content it would be easy to create conflicts if the files are modifiable from both ends, especially if a file is included in more than one script.
                          • how should we indicate that this mode is active?
                          • do we need a customizable interval for file checks or would a sensible default (eg. 3 seconds) be enough?
                          d.healeyD OrvillainO 2 Replies Last reply Reply Quote 2
                          • d.healeyD
                            d.healey @Christoph Hart
                            last edited by

                            @Christoph-Hart said in Coding in VS Code and HISE:

                            should we make external files read only

                            Good idea

                            @Christoph-Hart said in Coding in VS Code and HISE:

                            how should we indicate that this mode is active?

                            Slightly grey out the code editor. Hide the edit cursor. Put "External" in the tab header perhaps.

                            @Christoph-Hart said in Coding in VS Code and HISE:

                            do we need a customizable interval for file checks or would a sensible default (eg. 3 seconds) be enough?

                            3 seconds seems fine.

                            Did you see Watchman that @oskarsh mentioned in the other thread?

                            Free HISE Bootcamp Full Course for beginners.
                            YouTube Channel - Public HISE tutorials
                            My Patreon - HISE tutorials

                            Christoph HartC 1 Reply Last reply Reply Quote 0
                            • Christoph HartC
                              Christoph Hart @d.healey
                              last edited by

                              @d-healey said in Coding in VS Code and HISE:

                              Did you see Watchman that @oskarsh mentioned in the other thread?

                              No need for an external tool for this, I'll either cook something up using the JUCE File stuff or use something like this:

                              https://github.com/FigBug/Gin/blob/master/modules/gin/utilities/gin_filesystemwatcher.h

                              Christoph HartC 1 Reply Last reply Reply Quote 1
                              • Christoph HartC
                                Christoph Hart @Christoph Hart
                                last edited by

                                erm, there's already exactly that logic already in place: it checks external files every 3 seconds and reloads that. The only thing that's missing would be triggering a recompilation when changes are detected, but that should be fairly easy to implement.

                                d.healeyD 1 Reply Last reply Reply Quote 2
                                • d.healeyD
                                  d.healey @Christoph Hart
                                  last edited by

                                  @Christoph-Hart So @Dan-Korneff was right :)

                                  Free HISE Bootcamp Full Course for beginners.
                                  YouTube Channel - Public HISE tutorials
                                  My Patreon - HISE tutorials

                                  1 Reply Last reply Reply Quote 1
                                  • OrvillainO
                                    Orvillain @Christoph Hart
                                    last edited by

                                    @Christoph-Hart said in Coding in VS Code and HISE:

                                    If that is a popular request I can add a "external code editor mode" that can be enabled in the HISE compiler settings and will create file watchers with automatic file reload & recompilation.

                                    Let's talk pitfalls before I do that so we don't end up with something that trashes your code files:

                                    • should we make external files read only in the HISE code editor if this mode is enabled? Since the "source of truth" will switch in this mode to the actual file content it would be easy to create conflicts if the files are modifiable from both ends, especially if a file is included in more than one script.
                                    • how should we indicate that this mode is active?
                                    • do we need a customizable interval for file checks or would a sensible default (eg. 3 seconds) be enough?

                                    No need for read only in the HISE code editor IMO. Hise should just poll the file(s) for changes, maybe each time the window is accessed?? I quite often make major changes in VS Code, and then come into HISE, wait a few seconds and then compile, spot an error, and then quickly fix it directly in HISE. VS Code picks up the changes instantly.

                                    A customizable interval shouldn't really be needed, again IMO. It should just be as quick and transparent as possible. Like with Notepad++, VS Code, and other text editors.

                                    Musician - Instrument Designer - Sonic Architect - Creative Product Owner
                                    Crafting sound at every level. From strings to signal paths, samples to systems.

                                    Christoph HartC 1 Reply Last reply Reply Quote 0
                                    • Christoph HartC
                                      Christoph Hart @Orvillain
                                      last edited by

                                      Alright, I've pushed the following changes:

                                      • there's now a setting in the Scripting tab called RecompileOnFileChange. If this is enabled, then HISE will recompile all scripts that include the externally changed file.
                                      • it checks with a timer interval of 3 seconds for changes.
                                      • it also checks whenever a text editor gains the focus (so that you don't have to wait 3 seconds if you're as impatient as @Orvillain).
                                      • no need for making the editor read only, it's now always up to date.

                                      Let me know if that works as intended.

                                      d.healeyD OrvillainO VirtualVirginV 3 Replies Last reply Reply Quote 4
                                      • d.healeyD
                                        d.healey @Christoph Hart
                                        last edited by

                                        @Christoph-Hart said in Coding in VS Code and HISE:

                                        HISE will recompile all scripts that include the externally changed file.

                                        Does this apply to all script processors or just the UI script? And what about script processors that are using the Connect to External script feature?

                                        Free HISE Bootcamp Full Course for beginners.
                                        YouTube Channel - Public HISE tutorials
                                        My Patreon - HISE tutorials

                                        1 Reply Last reply Reply Quote 0
                                        • OrvillainO
                                          Orvillain @Christoph Hart
                                          last edited by

                                          @Christoph-Hart Nice one, will check!! 😁

                                          Musician - Instrument Designer - Sonic Architect - Creative Product Owner
                                          Crafting sound at every level. From strings to signal paths, samples to systems.

                                          1 Reply Last reply Reply Quote 0
                                          • VirtualVirginV
                                            VirtualVirgin @Christoph Hart
                                            last edited by

                                            @Christoph-Hart Sounds great! I'm traveling today so I won't get a chance to build and test until tomorrow, but I look forward to it :)

                                            You can listen to my orchestral mockups here:
                                            https://www.virtualvirgin.net/

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            35

                                            Online

                                            2.0k

                                            Users

                                            12.8k

                                            Topics

                                            110.8k

                                            Posts