AutoHotkey Plus Plus (AHK++) provides AutoHotkey v1 and v2 language support for VS Code. This includes:
- IntelliSense
- code highlighting
- debug support
- code formatting
- ...and more!
AutoHotkey v2 support has been a long-requested feature, and this release now supports nearly all functionality!
Supported features include:
- Running and debugging v1 and v2 scripts without changing settings
- "Open help" (Ctrl + F1) opens language-specific help (and includes your text selection!)
- Full syntax highlighting for v2 scripts
- Unique icons for v1 (blue) and v2 (green)
See the full changes at the changelog.
As always, please report any issues!
AutoHotkey Plus Plus is one of many extensions that offer VS Code language support. So why should you use this one?
- Supports both v1 and v2: AHK++ now has support for AutoHotkey v2 (in preview), making it the only extension to support both major versions of AutoHotkey!
- Actively maintained: Any issues encountered while using this extension can be reported and fixed. With other extensions, anything that's broken will stay broken forever. You can report any issues with AHK++ (and view all issues) through the issue tracker.
- IntelliSense: Smart code completion, syntax highlighting, code navigation, and more.
- Debug support: Run and debug AHK scripts from VS Code.
- New features: Another benefit to active maintenance is that AHK++ can add new features as users request them. For example, quick help, formatter directives, and custom new file templates were all added based on user feedback!
Install from VS Code or install from VS Code Marketplace: Install AutoHotkey Plus Plus.
With AHK++, you can compile, debug, and run your scripts with keyboard shortcuts. You can also run a selection as a standalone script.
- Compile:
Ctrl + Shift + F9
- Debug:
Ctrl + Alt + F9
- Open help:
Ctrl + F1
- Run:
Ctrl + F9
- Run selection:
Ctrl + F8
There are some known issues with the debugger. If you need an advanced setup, we recommend zero-plusplus.vscode-autohotkey-debug.
-
Click the debug button in the editor title menu (at the top right of the editor) or press
Ctrl + Alt + F9
. -
The debugger supports breakpoints, stack tracing, and variable watching
-
Output message: You can use
OutputDebug
command instead ofMsgBox
to log values. -
Evaluate: Set and get variable values through the debug console.
This extension provides basic debugging functions. If you need more debugging functions (such as conditional breakpoints), you can add an additional extension: Install vscode-autohotkey-debug.
Supports IntelliSense for variables and functions.
- You can add a comment to the function using a semicolon on the line above the function declaration
- Supports navigation to symbol definition.
- Usage: Ctrl-click on the symbol to navigate to its definition.
Select a symbol, then:
- Right-click and select
Find All References
. - Or press
Shift + F12
.
Usage: Hover over symbol to see IntelliSense documentation.
Assign name to block of code via double semicolon comment ;;Name
and go to it from outline.
Custom folding regions:
;region
MsgBox % "Collapse me!"
;endregion
; Block comments with regions
/* ;region
Collapse me!
*/ ;endregion
Supports standard VS Code formatting with a few options.
Formatter directives instruct the formatter to behave a certain way on sections of code.
-
FormatBlockComment
:;@AHK++FormatBlockCommentOn /* ;All text inside block comment will be formatted like regular code. */ ;@AHK++FormatBlockCommentOff
-
AlignAssignment
:;@AHK++AlignAssignmentOn a = 5 ; number five str = legacy text = with equal symbol inputFile := "movie.mkv" abc := "abc" ; string abc := a + b ;@AHK++AlignAssignmentOff
This extension relies heavily on open-source code. A huge thank you to all these open-source participants who made the extension what it is today!
- AutoHotkey Plus by cweijan: AHK++ is a fork of AutoHotkey Plus by cweijan (Weijan Chen)
- Contributions to AHK++ by kyklish: Greatly improved formatting and snippets by both fixing bugs and adding features
- AutoHotkey v2 Language Support by thqby: The source of the v2 grammar and other great contributions
- Lexikos/vscode-auto-select: The core code for automatically switching AHK versions
- AutoHotkey by stef-levesque: AutoHotkey Plus is a fork of stef-levesque's original AutoHotkey extension, which provided the original grammar and snippets for AHK