mark-wiemer-org / ahkpp

AutoHotkey Plus Plus (AHK++) - AutoHotkey v1 and v2 support for VS Code
https://marketplace.visualstudio.com/items?itemName=mark-wiemer.vscode-autohotkey-plus-plus
Other
152 stars 10 forks source link
ahk ahkv2 autohotkey autohotkey-v2 language-support vscode vscode-extension

AHK++

Full language support for AHK v1 and AHK v2

IntelliSense
Syntax highlighting
Debug support
Formatting (customizable!)
Quick help
...and more

Install

Install from VS Code or install from VS Code Marketplace.

AHK v2 full support is here! πŸ₯‚

AHK++ 6 now incorporates AutoHotkey v2 Language Support by thqby, meaning full AHK v2 support:

For all changes, including breaking changes, see the changelog

As always, please πŸ› report any issues

πŸ’š Special thanks again to thqby, as this would not have been possible without thqby's open-source AutoHotkey v2 Language Support!

⛓️‍πŸ’₯ Breaking changes

When adding all the new settings, VS Code's setting UX became overwhelming. Settings are now organized into flat objects, which should improve UX and reduce the need for breaking changes in the future! See the changelog for details.


Commands

With AHK++, you can compile, debug, and run your scripts with keyboard shortcuts. You can also run a selection as a standalone script.

Debug

There are some known issues with the debugger. If you need an advanced setup, we recommend zero-plusplus.vscode-autohotkey-debug for now. Please open an issue if the built-in debugger does not support your needs. As zero-plusplus.vscode-autohotkey-debug is closed-source, we will be working to introduce advanced debugger features to ensure an open-source, collaborative, complete extension is available to the AHK community πŸ™‚

  1. Click the debug button in the editor title menu (at the top right of the editor) or press Ctrl + Alt + F9.
  2. The debugger supports breakpoints, stack tracing, and variable watching

    Debug

Debug features

  1. Output message: You can use OutputDebug command instead of MsgBox to log values.

    Output

  2. Evaluate: Set and get variable values through the debug console.

    Evaluate

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.

Language Features

IntelliSense

Supports IntelliSense for variables and functions.

Function symbol

  1. You can add a comment to the function using a semicolon on the line above the function declaration

Go to definition

  1. Supports navigation to symbol definition.
  2. Usage: Ctrl-click on the symbol to navigate to its definition.

Goto Definition

Find symbol references

Select a symbol, then:

Hover tip

Usage: Hover over symbol to see IntelliSense documentation.

Hover

Outline

Assign name to block of code via double semicolon comment ;;Name and go to it from outline.

Block Name

Folding

Custom folding regions:

;region
MsgBox % "Collapse me!"
;endregion

; Block comments with regions
/* ;region
Collapse me!
*/ ;endregion

Code format

Supports standard VS Code formatting with a few options.

Code Format

Formatter Directives

Formatter directives instruct the formatter to behave a certain way on sections of code.

  1. FormatBlockComment:

    ;@AHK++FormatBlockCommentOn
    /*
    ;All text inside block comment will be formatted like regular code.
    */
    ;@AHK++FormatBlockCommentOff
  2. AlignAssignment:

    ;@AHK++AlignAssignmentOn
    a          = 5 ; number five
    str        = legacy text = with equal symbol
    inputFile := "movie.mkv"
    abc       := "abc" ; string
    abc       := a + b
    ;@AHK++AlignAssignmentOff

Credits

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!

Links