Page 1 of 4
new vscode extension allows advanced AHK V1/V2 debugging
Posted: 17 Jun 2020, 20:50
by SAbboushi
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:
- 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
- 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
Re: new vscode extension allows advanced AHK V1/V2 debugging
Posted: 17 Jun 2020, 20:53
by gregster
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?
Re: new vscode extension allows advanced AHK V1/V2 debugging
Posted: 17 Jun 2020, 21:06
by SAbboushi
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
Re: new vscode extension allows advanced AHK V1/V2 debugging
Posted: 17 Jun 2020, 21:07
by gregster
Cool, thank you!
I'll try it.
Re: new vscode extension allows advanced AHK V1/V2 debugging
Posted: 18 Jun 2020, 05:54
by boiler
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?
Re: new vscode extension allows advanced AHK V1/V2 debugging
Posted: 18 Jun 2020, 10:59
by SAbboushi
I posted in Editors with link to this thread. I agree it might make more sense if moderator moved this thread to Editors
Re: new vscode extension allows advanced AHK V1/V2 debugging
Posted: 18 Jun 2020, 11:05
by gregster
SAbboushi wrote: ↑18 Jun 2020, 10:59
I agree it might make more sense if moderator moved this thread to Editors
Done!
Re: new vscode extension allows advanced AHK V1/V2 debugging
Posted: 19 Jun 2020, 10:17
by SAbboushi
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
- SciTE4AutoHotkey.png (164.61 KiB) Viewed 13648 times
- dudelmoser
- dudelmoser.png (56.88 KiB) Viewed 13648 times
Re: new vscode extension allows advanced AHK V1/V2 debugging
Posted: 19 Jun 2020, 10:22
by SAbboushi
Some screen shots:
- vscodeAHKV2.png (301.51 KiB) Viewed 13632 times
- vscodeAHKV2_folders.png (18.71 KiB) Viewed 13480 times
Re: new vscode extension allows advanced AHK V1/V2 debugging
Posted: 19 Jun 2020, 10:31
by boiler
@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?
Re: new vscode extension allows advanced AHK V1/V2 debugging
Posted: 19 Jun 2020, 10:47
by SAbboushi
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 (40.78 KiB) Viewed 13497 times
Re: new vscode extension allows advanced AHK V1/V2 debugging
Posted: 19 Jun 2020, 11:00
by boiler
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?
Re: new vscode extension allows advanced AHK V1/V2 debugging
Posted: 19 Jun 2020, 11:14
by SAbboushi
Nope. I use .ahk extension for all versions
Re: new vscode extension allows advanced AHK V1/V2 debugging
Posted: 19 Jun 2020, 11:16
by SAbboushi
I'm able to run/debug multiple v1 .ahk and multiple v2 .ahk all at the same time.
Re: new vscode extension allows advanced AHK V1/V2 debugging
Posted: 19 Jun 2020, 11:26
by boiler
Good to know. Thanks for the info!
Re: new vscode extension allows advanced AHK V1/V2 debugging
Posted: 20 Jun 2020, 17:07
by SAbboushi
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 (23.72 KiB) Viewed 12600 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):
Really love:
- Massive library of vscode extensions e.g. Auto-Align, Bracket Pair Colorizer 2, Insert Numbers...
Re: new vscode extension allows advanced AHK V1/V2 debugging
Posted: 20 Jun 2020, 18:38
by SAbboushi
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:
Hover over
Var1 will display the current value; hover over
var1 or
VAR1 does not display current value
Re: new vscode extension allows advanced AHK V1/V2 debugging
Posted: 15 Jul 2020, 11:58
by SAbboushi
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)
Re: new vscode extension allows advanced AHK V1/V2 debugging
Posted: 11 Nov 2020, 08:07
by fade2gray
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.
Re: new vscode extension allows advanced AHK V1/V2 debugging
Posted: 11 Nov 2020, 08:13
by boiler
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.