new vscode extension allows advanced AHK V1/V2 debugging

Scripting and setups with Visual Studio Code (vscode) and AutoHotkey.
SAbboushi
Posts: 252
Joined: 08 Dec 2014, 22:13

new vscode extension allows advanced AHK V1/V2 debugging

17 Jun 2020, 20:50

I recently switched over to vscode for editing and debugging AHK V1 and V2 scripts using extension vscode-autohotkey-debug.

Highlights:
Can debug multiple scripts concurrently of all of the following:
  • Elevated scripts
  • Non-elevated scripts
  • AHK V1 scripts with V1 language support (not sure how current)
  • AHK V2 scripts with V2 language support (not sure how current)
  • Varying script extensions e.g. .ahk, .ahk2, .ah2
Also:
  • Doesn’t slow down over time while single-stepping
  • Can click on error line in DEBUG CONSOLE to jump to error line of code
  • Watch expressions
  • Advanced breakpoint:
    • Conditional breakpoints on VariableName or Primitive with simple operators
    • Hit Count breakpoints for how many times a line is executed
And with all the amazing power of vscode editing and customization
User avatar
gregster
Posts: 9224
Joined: 30 Sep 2013, 06:48

Re: new vscode extension allows advanced AHK V1/V2 debugging

17 Jun 2020, 20:53

Do you have a link to this new extension? Or a name? Edit: I assume it's called "vscode-autohotkey-debug"?
Or is it obvious?
SAbboushi
Posts: 252
Joined: 08 Dec 2014, 22:13

Re: new vscode extension allows advanced AHK V1/V2 debugging

17 Jun 2020, 21:06

https://github.com/zero-plusplus/vscode-autohotkey-debug

If you install vscode, you can find it by typing "vscode-autohotkey-debug" in the "Search Extensions in Marketplace" box
User avatar
gregster
Posts: 9224
Joined: 30 Sep 2013, 06:48

Re: new vscode extension allows advanced AHK V1/V2 debugging

17 Jun 2020, 21:07

Cool, thank you!
I'll try it.
User avatar
boiler
Posts: 17706
Joined: 21 Dec 2014, 02:44

Re: new vscode extension allows advanced AHK V1/V2 debugging

18 Jun 2020, 05:54

Thanks for posting this.

Should this thread be moved to or duplicated in the Editors sub-forum so it would be found when people are looking there for VSCode-related tools?
SAbboushi
Posts: 252
Joined: 08 Dec 2014, 22:13

Re: new vscode extension allows advanced AHK V1/V2 debugging

18 Jun 2020, 10:59

I posted in Editors with link to this thread. I agree it might make more sense if moderator moved this thread to Editors
User avatar
gregster
Posts: 9224
Joined: 30 Sep 2013, 06:48

Re: new vscode extension allows advanced AHK V1/V2 debugging

18 Jun 2020, 11:05

SAbboushi wrote:
18 Jun 2020, 10:59
I agree it might make more sense if moderator moved this thread to Editors
Done! :thumbup:
SAbboushi
Posts: 252
Joined: 08 Dec 2014, 22:13

Re: new vscode extension allows advanced AHK V1/V2 debugging

19 Jun 2020, 10:17

Sweet!

Can easily run/debug (concurrently) multiple AHK versions (e.g. a108, a111...) with scripts associated with those versions (e.g. LibV2, LibV2_a108). I'm finding that very useful when I need to update scripts to make them compatible with new V2 updates like v2.0-a111-06d0a13b that has "numerous compatibility-breaking changes".

And I'm loving being able to code/debug in vscode. Although I much prefer the syntax highlighting I've got in SciTE4AutoHotkey...
SciTE4AutoHotkey.png
SciTE4AutoHotkey
SciTE4AutoHotkey.png (164.61 KiB) Viewed 13649 times
dudelmoser.png
dudelmoser
dudelmoser.png (56.88 KiB) Viewed 13649 times
SAbboushi
Posts: 252
Joined: 08 Dec 2014, 22:13

Re: new vscode extension allows advanced AHK V1/V2 debugging

19 Jun 2020, 10:22

Some screen shots:
vscodeAHKV2.png
vscodeAHKV2.png (301.51 KiB) Viewed 13633 times
vscodeAHKV2_folders.png
vscodeAHKV2_folders.png (18.71 KiB) Viewed 13481 times
Last edited by SAbboushi on 19 Jun 2020, 10:49, edited 1 time in total.
User avatar
boiler
Posts: 17706
Joined: 21 Dec 2014, 02:44

Re: new vscode extension allows advanced AHK V1/V2 debugging

19 Jun 2020, 10:31

@SAbboushi - I use VSCode for AHK v1 but really haven’t for v2 yet. The debugger looks great. Are you just using one of the syntax highlighters for v1, or is there one that works for both v1 and v2 that includes the new v2 keywords? And do you use anything for parameter hints and auto-complete for v2?
SAbboushi
Posts: 252
Joined: 08 Dec 2014, 22:13

Re: new vscode extension allows advanced AHK V1/V2 debugging

19 Jun 2020, 10:47

I'm using dudelmoser's language extension for V2 and slevesque's for V1.

dudelmoser's extension provides autocomplete and parameter hints (but looks like it hasn't been updated for 5 months...).

Typing #S:
dudelmoser_autocomplete.png
dudelmoser_autocomplete.png (40.78 KiB) Viewed 13498 times
User avatar
boiler
Posts: 17706
Joined: 21 Dec 2014, 02:44

Re: new vscode extension allows advanced AHK V1/V2 debugging

19 Jun 2020, 11:00

Thanks. Do you have to use a different file extension for AHK v2 files in order to use VSCode for both and not have the extensions conflict?
SAbboushi
Posts: 252
Joined: 08 Dec 2014, 22:13

Re: new vscode extension allows advanced AHK V1/V2 debugging

19 Jun 2020, 11:14

Nope. I use .ahk extension for all versions
SAbboushi
Posts: 252
Joined: 08 Dec 2014, 22:13

Re: new vscode extension allows advanced AHK V1/V2 debugging

19 Jun 2020, 11:16

I'm able to run/debug multiple v1 .ahk and multiple v2 .ahk all at the same time.
User avatar
boiler
Posts: 17706
Joined: 21 Dec 2014, 02:44

Re: new vscode extension allows advanced AHK V1/V2 debugging

19 Jun 2020, 11:26

Good to know. Thanks for the info!
SAbboushi
Posts: 252
Joined: 08 Dec 2014, 22:13

Re: new vscode extension allows advanced AHK V1/V2 debugging

20 Jun 2020, 17:07

I like the vertical lines in the Variables pane: after years and years, I still get confused without having to collapse a hierarchy: these vertical lines make it more intuitive for me:
vscode_variablesPaneVerticalLines.png
vscode_variablesPaneVerticalLines.png (23.72 KiB) Viewed 12601 times

Other features I like (they save a couple mouse clicks/keystrokes each time):
  • Run to cursor (I'm not setting and clearing breakpoints as often)
  • Restart script debugging (don't have to stop and then enable/start debugging again)

Features I miss and hope will be implemented within next few months:
  • Being able to launch (i.e. not debug) script from vscode which stays running when closing vscode

What I don't like (vscode architecture unrelated to the extension):
  • Can't undock panes...

Really love:
  • Massive library of vscode extensions e.g. Auto-Align, Bracket Pair Colorizer 2, Insert Numbers...
SAbboushi
Posts: 252
Joined: 08 Dec 2014, 22:13

Re: new vscode extension allows advanced AHK V1/V2 debugging

20 Jun 2020, 18:38

Very Nice: VARIABLES Pane variables and values are relative to the selected stack frame in the CALL STACK section

Gotcha: Data Inspection Hover over variable names is case sensitive: the first used variable name wins:

Code: Select all

Var1 := 0
var1 := 1
VAR1 := 2
Hover over Var1 will display the current value; hover over var1 or VAR1 does not display current value
SAbboushi
Posts: 252
Joined: 08 Dec 2014, 22:13

Re: new vscode extension allows advanced AHK V1/V2 debugging

15 Jul 2020, 11:58

REALLY nice to be in vscode and simply open a new vscode "Workspace" to switch from using [a108] scripts/libraries/ahk executables to [a116]; or to have two instances of vscode open, one with [a108] Workspace and the other with [a116] Workspace while debugging an [a108] script and making it compatible with [a116] (i.e. [a108] script is paused at a breakpoint while I'm modifying/debugging the [a116] version script)
User avatar
fade2gray
Posts: 87
Joined: 21 Apr 2015, 12:28

Re: new vscode extension allows advanced AHK V1/V2 debugging

11 Nov 2020, 08:07

I can muddle my way through most basic AHK scripting, but I am unable to find a method to determine the column position of the text insertion caret within a VSCode editor.

I'm thinking this might involve a PostMessage/SendMessage of some description, but this is beyond my comprehension.

I don't like asking to be spoonfed, but can some point me in the right direction?

Thanks.

Note: I use the vscode-autohotkey-Plus extension.
User avatar
boiler
Posts: 17706
Joined: 21 Dec 2014, 02:44

Re: new vscode extension allows advanced AHK V1/V2 debugging

11 Nov 2020, 08:13

I haven’t been able to find away to determine the caret position in VSCode either, and I have spent a bit of time retrying. I have resorted to using ImageSearch to locate it, which works well for my purpose, but that’s returning a position in pixels, not column position.

Return to “Visual Studio Code”

Who is online

Users browsing this forum: No registered users and 16 guests