mark-wiemer-org/ahkpp

Flip-flopping Schrödinger's cat

fade2gray opened this issue · 3 comments

Description

If you have a Workgroup with several v1 scripts open (all scripts have had v1 mode selected and all tabs have blue icons) - if you close and re-open the Workgroup, only the tab/s that had focus prior to closing the Workgroup will display the blue icon, all other tab icons will now be green, supposedly indicating v2, until they are each individually clicked on.

One Workgroup I have has 30+ tabs open with v1 scripts, and all except 2 are identified as v2 when the Workgroup is re-opened until the v1 scripts are re-clicked on - that is all except for some that remain green, I think due to ambiguous code that is common to both v1 and v2 in which case you have to re-select the v1 language mode for each instance.

Hence, 'Schrödinger's Cat' as you don't know if the code is v1 or v2 until you open the box. 😊

Additional context

v1-v2_FlipFlop.mp4

Rinse and repeat.

Very strange. I don't use workgroups much but this may have to do with the default language for .ahk files being AHK v2 on your machine / in general?

Additionally, there is code that finds the first #Requires directive and updates the file's language according to that. I could have that run on every open editor when the window loads right away, that should resolve the issue.

Let me see if I can reproduce this :)

Yes, this is because the default language mode for .ahk is currently AHK v2, and language mode selections don't save in VS Code--when you close VS Code, you lose the selection. I should be able to push a quick patch using the code mentioned above :)

Note: you will need to add a #Requires directive to the top of each file to distinguish it, e.g. #Requires AutoHotkey 1 or #Requires AutoHotkey 2, hopefully this isn't too much of an inconvenience :)