Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flip-flopping Schrödinger's cat #392

Closed
fade2gray opened this issue Aug 10, 2023 · 3 comments · Fixed by #393
Closed

Flip-flopping Schrödinger's cat #392

fade2gray opened this issue Aug 10, 2023 · 3 comments · Fixed by #393
Assignees
Labels
bug something isn't working language mode v1 scripts wrongly identified as v2 or vice versa

Comments

@fade2gray
Copy link

fade2gray commented Aug 10, 2023

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.

@fade2gray fade2gray added the bug something isn't working label Aug 10, 2023
@mark-wiemer
Copy link
Member

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 :)

@mark-wiemer mark-wiemer added the language mode v1 scripts wrongly identified as v2 or vice versa label Aug 11, 2023
@mark-wiemer
Copy link
Member

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 :)

@mark-wiemer
Copy link
Member

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 :)

github-merge-queue bot pushed a commit that referenced this issue Aug 11, 2023
* Fix #392

* Bump version

* Update tests to be default-lang-independent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something isn't working language mode v1 scripts wrongly identified as v2 or vice versa
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants