GithubHelp home page GithubHelp logo

mark-wiemer-org / ahkpp Goto Github PK

View Code? Open in Web Editor NEW
140.0 4.0 9.0 1.94 MB

AutoHotkey Plus Plus: AutoHotkey language support for Visual Studio Code

Home Page: https://marketplace.visualstudio.com/items?itemName=mark-wiemer.vscode-autohotkey-plus-plus

License: Other

TypeScript 46.46% AutoHotkey 53.36% Shell 0.01% JavaScript 0.17%
autohotkey vscode-extension language-support vscode

ahkpp's Introduction

AutoHotkey Plus Plus (AHK++)

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!

5.0.0 - AutoHotkey v2 support now in preview!

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!

Contents

Why AutoHotkey Plus Plus?

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

Install from VS Code or install from VS Code Marketplace: Install AutoHotkey Plus Plus.

Commands

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

Debug

There are some known issues with the debugger. If you need an advanced setup, we recommend zero-plusplus.vscode-autohotkey-debug.

  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:

  • Right-click and select Find All References.
  • Or press Shift + F12.

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

  • GitHub: View code, file bugs, and join discussions
  • Reviews: Help others discover AHK++ by leaving a review

ahkpp's People

Contributors

afspeirs avatar beerrider avatar benny779 avatar bhughes339 avatar catfist avatar cweijan avatar denolfe avatar dependabot[bot] avatar fade2gray avatar hicsy avatar kyklish avatar mark-wiemer avatar oiss avatar stef-levesque avatar tmplinshi avatar usernamehw avatar zero-plusplus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ahkpp's Issues

Go to symbol in workspace doesnt work

Hi,
Go to definition works ok with multiple included files but i cant go to a function/symbol in other files. "Go to symbol in editor" works ok. For example;

---- main script
| #include funcs.ahk
| ...
---funcs.ahk
| foo() { ... }
|

I cant quickly go to foo() definition when im at the main script. Isnt this what "go to symbol in workspace" for.

Thanks.

hotkey (:: should not double indent

it's because of the ( LTrim Join indentation "feature", it doesn't happen in v.2.7.0

Unformatted input snippet

(::
foo()

Expected formatted output snippet

(::
    foo()

Actual formatted output snippet

(::
        foo()

Document Format - Switch/Case Statements - Invalid Indentation

Describe the bug

The result of using Format Document when code reaches a Switch statement is incorrect/badly formatted.

To Reproduce

Steps to reproduce the behavior:

Create Code Block in file.
Use Right Click -> Format Document


    GetClickType() {
        k := This.keyType
        Switch k {
        Case "RButton":
        return "right"
    Case "LButton":
    return "left"
Case "MButton":
return "mid"
Default:
return This.key
}
}


Expected behavior

GetClickType() {
    k := This.keyType
    Switch k {
    Case "RButton":
        return "right"
    Case "LButton":
        return "left"
    Case "MButton":
        return "mid"
    Default:
        return This.key
    }
}

Additional context

Add any other context about the problem here, including screenshots. If no context is needed, please remove this section.
image

image

Regarding issue/enhancement #100

@wenfangdu (It appears you have decided to block my comments)

Regarding Code Runner's icon and the AutoHotkey Plus Plus debugger icon:

Code Runner's icon appears when any Plain Text or any script editor has focus, but when an AHK++ editor has focus, both icons are displayed unless the option to not display the AHK++ icon has been chosen.

debug-icon-2

Note: replaced non working vid with working vid.

Untitled.mp4

Intellisense fails with an "Illegal argument: value" error on hover

Describe the bug
When hovering over any AHK function, Intellisense silently fails, producing an error only visible within the developer console.

To Reproduce
Steps to reproduce the behavior:

  1. Install the latest edition of VSCode under the user directory in Windows 10 (C:\Users\<username>\AppData\Local\Programs\Microsoft VS Code)
  2. Install AutoHotkey Plus Plus extension within VSCode
  3. Configure the extension to point to the proper execute/compile paths and ensure Intellisense is enabled
  4. Create a file with the sole contents being sleep 100
  5. Open Developer Tools within VSCode
  6. Hover over "Sleep" and observe the generated error in the console of the developer tools.

Expected behavior
An intellisense view should open detailing the Sleep function, when a user hovers over said function.

Desktop (please complete the following information):

  • OS: Microsoft Windows 10 Home
  • Version 10.0.18363 Build 18363

VSCode

  • Version: 1.52.0 (user setup)
  • Commit: 940b5f4bb5fa47866a54529ed759d95d09ee80be
  • Date: 2020-12-10T22:45:11.850Z
  • Electron: 9.3.5
  • Chrome: 83.0.4103.122
  • Node.js: 12.14.1
  • V8: 8.3.110.13-electron.0
  • OS: Windows_NT x64 10.0.18363
  • Installation directory: C:\Users\mrand\AppData\Local\Programs\Microsoft VS Code

AutoHotkey

  • Version: 1.1.33.02
  • Installation directory: D:\Program Files\AutoHotkey

Produced error

  ERR Illegal argument: value: Error: Illegal argument: value
	at Object.t.illegalArgument (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:11:10)
	at new o (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:302:37)
	at new P (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:548:49)
	at new P (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:531:904)
	at AhkHoverProvider.tryGetSnippetHover (c:\Users\mrand\.vscode\extensions\mark-wiemer.vscode-autohotkey-plus-plus-2.5.12\out\provider\ahkHoverProvider.js:46:29)
	at AhkHoverProvider.<anonymous> (c:\Users\mrand\.vscode\extensions\mark-wiemer.vscode-autohotkey-plus-plus-2.5.12\out\provider\ahkHoverProvider.js:24:39)
	at Generator.next (<anonymous>)
	at c:\Users\mrand\.vscode\extensions\mark-wiemer.vscode-autohotkey-plus-plus-2.5.12\out\provider\ahkHoverProvider.js:8:71
	at new Promise (<anonymous>)
	at __awaiter (c:\Users\mrand\.vscode\extensions\mark-wiemer.vscode-autohotkey-plus-plus-2.5.12\out\provider\ahkHoverProvider.js:4:12)
	at AhkHoverProvider.provideHover (c:\Users\mrand\.vscode\extensions\mark-wiemer.vscode-autohotkey-plus-plus-2.5.12\out\provider\ahkHoverProvider.js:22:16)
	at c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:753:757
	at c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:52:1010
	at new Promise (<anonymous>)
	at Object.t.asPromise (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:52:982)
	at S.provideHover (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:753:728)
	at c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:775:165
	at q._withAdapter (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:772:10)
	at q.$provideHover (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:775:143)
	at m._doInvokeHandler (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:892:926)
	at m._invokeHandler (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:892:618)
	at m._receiveRequest (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:891:201)
	at m._receiveOneMessage (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:890:6)
	at c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:888:136
	at l.fire (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:46:801)
	at v.fire (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:233:787)
	at c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:1094:104
	at l.fire (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:46:801)
	at v.fire (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:233:787)
	at t.PersistentProtocol._receiveMessage (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:238:1004)
	at c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:235:927
	at l.fire (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:46:801)
	at p.acceptChunk (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:231:195)
	at c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:230:547
	at Socket.t (c:\Users\mrand\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:240:822)
	at Socket.emit (events.js:223:5)
	at addChunk (_stream_readable.js:309:12)
	at readableAddChunk (_stream_readable.js:290:11)
	at Socket.Readable.push (_stream_readable.js:224:10)
	at Pipe.onStreamRead (internal/stream_base_commons.js:181:23)

v.2.7.1 multiline function indents if there's ( below

reverting to v.2.7.0 fixed it

Unformatted input AND expected output

; it doesn't indent if there's no ()

DllCall( variable
, "UInt",1 )

; 1 wrapped with () indents...

DllCall( variable
, "UInt", (1) )

; indents the ENTIRE script below, there should be no indent

; it doesn't indent if there's no ()
DllCall( "string"
, "UInt", 1 )

; 1 wrapped with () indents...
DllCall( "string"
, "UInt", (1) )


; here, it's indents
; just to show
SubStr( "string"
, "UInt", (1) )
SubStr( "string"
, "UInt", (1) )
SubStr( "string"
, "UInt", (1) )

return
return
;return doesn't help, doesn't reset the indent.

Actual formatted output snippet

; it doesn't indent if there's no ()

DllCall( variable
, "UInt",1 )

; 1 wrapped with () indents...

DllCall( variable
    , "UInt", (1) )

    ; indents the ENTIRE script below, there should be no indent

    ; it doesn't indent if there's no ()
    DllCall( "string"
    , "UInt", 1 )

    ; 1 wrapped with () indents...
    DllCall( "string"
        , "UInt", (1) )


        ; here, it's indents
        ; just to show
        SubStr( "string"
            , "UInt", (1) )
            SubStr( "string"
                , "UInt", (1) )
                SubStr( "string"
                    , "UInt", (1) )

                    return
                    return
                    ;return doesn't help, doesn't reset the indent.

the code it breaks:

/*
 _      _    _               __ __      _      _                      _         _                        
| |__  | |_ | |_  _ __  _   / // /__ _ | |__  | | __ ___   ___  _ __ (_) _ __  | |_     ___   _ __  __ _ 
| '_ \ | __|| __|| '_ \(_) / // // _` || '_ \ | |/ // __| / __|| '__|| || '_ \ | __|   / _ \ | '__|/ _` |
| | | || |_ | |_ | |_) |_ / // /| (_| || | | ||   < \__ \| (__ | |   | || |_) || |_  _| (_) || |  | (_| |
|_| |_| \__| \__|| .__/(_)_//_/  \__,_||_| |_||_|\_\|___/ \___||_|   |_|| .__/  \__|(_)\___/ |_|   \__, |
                 |_|                                                    |_|                        |___/ 
RunAsTask() - Auto-elevates script without UAC prompt |  http://ahkscript.org/boards/viewtopic.php?t=4334        
_________________________________________________________________________________________________________
*/

RunAsTask() { ;  By SKAN,  http://goo.gl/yG6A1F,  CD:19/Aug/2014 | MD:24/Apr/2020

    Local CmdLine, TaskName, TaskExists, XML, TaskSchd, TaskRoot, RunAsTask
    Local TASK_CREATE := 0x2, TASK_LOGON_INTERACTIVE_TOKEN := 3 

    Try TaskSchd := ComObjCreate( "Schedule.Service" ), TaskSchd.Connect()
    , TaskRoot := TaskSchd.GetFolder( "\" )
    Catch
        Return "", ErrorLevel := 1 

    CmdLine := ( A_IsCompiled ? "" : """" A_AhkPath """" ) A_Space ( """" A_ScriptFullpath """" )
    TaskName := "[RunAsTask] " A_ScriptName " @" SubStr( "000000000" DllCall( "NTDLL\RtlComputeCrc32"
        , "Int",0, "WStr",CmdLine, "UInt",StrLen( CmdLine ) * 2, "UInt" ), -9 )

        Try RunAsTask := TaskRoot.GetTask( TaskName )
        TaskExists := ! A_LastError 

        If ( not A_IsAdmin and TaskExists ) { 

            RunAsTask.Run( "" )
            ExitApp

        }

        If ( not A_IsAdmin and not TaskExists ) { 

            Run *RunAs %CmdLine%, %A_ScriptDir%, UseErrorLevel
            ExitApp

        }

        If ( A_IsAdmin and not TaskExists ) { 

            XML := "
            ( LTrim Join
                <?xml version=""1.0"" ?><Task xmlns=""http://schemas.microsoft.com/windows/2004/02/mit/task""><Regi
                strationInfo /><Triggers /><Principals><Principal id=""Author""><LogonType>InteractiveToken</LogonT
                ype><RunLevel>HighestAvailable</RunLevel></Principal></Principals><Settings><MultipleInstancesPolic
                y>Parallel</MultipleInstancesPolicy><DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries><
                StopIfGoingOnBatteries>false</StopIfGoingOnBatteries><AllowHardTerminate>false</AllowHardTerminate>
                <StartWhenAvailable>false</StartWhenAvailable><RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAva
                ilable><IdleSettings><StopOnIdleEnd>true</StopOnIdleEnd><RestartOnIdle>false</RestartOnIdle></IdleS
                ettings><AllowStartOnDemand>true</AllowStartOnDemand><Enabled>true</Enabled><Hidden>false</Hidden><
                RunOnlyIfIdle>false</RunOnlyIfIdle><DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteApp
                Session><UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine><WakeToRun>false</WakeToRun><
                ExecutionTimeLimit>PT0S</ExecutionTimeLimit></Settings><Actions Context=""Author""><Exec>
                <Command>""" ( A_IsCompiled ? A_ScriptFullpath : A_AhkPath ) """</Command>
                <Arguments>" ( !A_IsCompiled ? """" A_ScriptFullpath """" : "" ) "</Arguments>
                <WorkingDirectory>" A_ScriptDir "</WorkingDirectory></Exec></Actions></Task>
            )" 

            TaskRoot.RegisterTask( TaskName, XML, TASK_CREATE, "", "", TASK_LOGON_INTERACTIVE_TOKEN )

        } 

        Return TaskName, ErrorLevel := 0
    } ; _____________________________________________________________________________________________________
    ;rip below
    f1::

"Link" not recognized as keyword

The keyword 'Link', which is an AHK GuiControl, is not recognized as such and is treated as a variable

Reproduction steps

Gui, 1:Add, Edit,, sample text
Gui, 1:Add, Link,, sample <a href="http://[...]">link</a>
Gui, 1:Add, Text,, sample text

Results in unexpected syntax coloring:
image

Expected behavior

'Link' keyword color should be same as 'Edit' or 'Text' (not sure which)

Improper indentation after "else"

Description

Statements after single-line else statement are indented one level more than expected.

Unformatted input snippet

encoding := "utf-16"
if (encoding = "utf-16")
encodingSize := 2, charType := "UShort"
else encodingSize := 1, charType := "Char"
MsgBox, Bytes per char: %encodingSize%

Expected formatted output snippet

encoding := "utf-16"
if (encoding = "utf-16")
    encodingSize := 2, charType := "UShort"
else encodingSize := 1, charType := "Char"
MsgBox, Bytes per char: %encodingSize%

or preferably:

encoding := "utf-16"
if (encoding = "utf-16")
    encodingSize := 2, charType := "UShort"
else
    encodingSize := 1, charType := "Char"
MsgBox, Bytes per char: %encodingSize%

Actual formatted output snippet

encoding := "utf-16"
if (encoding = "utf-16")
    encodingSize := 2, charType := "UShort"
else encodingSize := 1, charType := "Char"
    MsgBox, Bytes per char: %encodingSize%

Yes, the original unformatted input sucks. But one purpose of formatting is to help understand badly-written code. The debugger parses it correctly, always executing the last line regardless of its indentation. Using AHK's own AST for formatting
would avoid inconsistencies between appearance and performance.

Formatting: indentation added on unquoted v1 string with "for"

Found: Formatting this:

InputBox, name, for bla
if somthing
    Return

turns to:

InputBox, name, for bla
    if somthing
    Return

No change expected here.

OK. There you go :) (regarding #58)
Maybe the formatter should ignore the for if there is a keyword in the beginning of the line? 🤔

(still dunno where to look myself. sorry)

comment after '#Include' not recognized as comment

Description

a comment inserted after an Include statement is treated like a string instead of a comment:
image

Expected behavior

The comment after #Include should be syntax colored the same as other comments

Ahk v2 snippets - is it possible to be able to switch snippets in the setting V1 - V2

I have create an updates snippet file for ahk V2 with the intention to just be used for V2.
Is it possible to switch between the snippet files?
If it is possible, it would also be nice to be able to switch also to another syntax file for v2. where old variables and functions are made bold red or striped, and new ones are added. The quotes are also changed in V2, not sure if it is easy to include this.

https://github.com/dmtr99/AHK-V2-Syntax-Visual-Studio-Code/blob/main/ah2.code-snippets

Add option to disable syntax highlighting

Is your feature request related to a problem? Please describe.
Syntax highlighting in this extension isn't good, but many other features are. I want to combine this extension with another, but they clash on syntax highlighting so I can't.

Describe the solution you'd like
Ideally I can disable syntax highlighting from this extension, and enable another extension specifically for syntax highlighting. That way, I can have great syntax highlighting plus all the other features of AHK++.

Bonus: Just fix the syntax highlighting of AHK++ ;)

Describe alternatives you've considered
Trying to enable and disable extensions as needed is possible, but very clunky.

Additional context
See Use this extension along with "AutoHotKey2 Language Support" by thqby for syntax error highlighting · Discussion #75 · mark-wiemer/vscode-autohotkey-plus-plus

Run command is not working

Not sure if this is an issue with the AHK++ plugin, but when I try to use the RUN command to launch an application from a directory it doesn't work, nothing happens at all.

But when trying the same exact thing in SCITE is works fine.

Is this a known issue? or am I missing something here?

Keep code preview being shown while you are typing

On AutoHotkeyScite it displays the snippet (not sure if this thing is called "snippet") of the function while you are typing:

KxAyA

On vscode, when I type anything it disappears:

2021-04-20_17-27-20

Is possible to do the same?

Q: how to configure VS Code launch.json & settings.json

Hello,
it look like it does not run properly on my machine, can you share settings for launch.json & settings.json
My are:

  1. launch.json
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [  
        
    {
        "type": "ahk",
        "request": "launch",
        "name": "AutoHotkey Debugger",
        "program": "",
        "stopOnEntry": true
    }
    ]
}

and

  1. settings.json
     "code-runner.executorMap": {
            ....
             "ahk": "autohotkey",      
            ....
       }
     "files.associations": {
         "*.ahk": "ahk"
     },
     "ahk++.compilePath": "C:/MEINS/TOOLS/AutoHotkey/Compiler/Ahk2Exe.exe",
     "ahk++.executePath": "C:/MEINS/TOOLS/AutoHotkey/AutoHotkeyU64.exe",
     "ahk++.helpPath": "C:/MEINS/TOOLS/AutoHotkey/AutoHotkey.chm"
    

}

Formatting: function returns don't indent after subroutines

It appears that a function that is defined after a subroutine has this quirk or not having proper indentation when using a return statment.

example:

func1(x, y) {
    return x + y
}

Subroutine:
    msgbox, welcome
return

func2(x, y) {
return x * y
}

Each statement in these three blocks should indent but the last one does not.
However, it will if you remove the subroutine.

Edit:

This also occurs after hotkeys.

func1(x, y) {
    return x + y
}

^SPACE::
    msgbox, hello
return

func2(x, y) {
return x * y
}

IntelliSense: Unchecking the setting has no effect

Describe the bug

Assuming that IntelliSense is responsible for 'autocomplete' and detailed descriptions of functions etc., toggling the setting on/off seems not to have any effect after reload.

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'AutoHotkey Plus Plus settings'
  2. Uncheck 'Enable IntelliSense (Preview). Changes take effect after reload.'
  3. Reload 'F1 - Developer: Reload Window'
  4. Test script for autocomplete and/or descriptive tooltips.

Expected behavior

IntelliSense to be disabled.

Additional context

Should Reload and Shutdown/Restart have the same effect (Ref: #39)- neither make any difference after unchecking IntelliSense.

Some functions are not being colored properly.

nocolor

Some of my functions are not being colored correctly.

morecolor

Here is the code in the images:

<#Tab::     AltTab
<#c::       CenterActiveWindow()
$LAlt::     LAlt()
$*Pause::   Pause()
$AppsKey::  AppsKey()
$CapsLock:: CapsLock()

Block/Multiple-line commenting

I would like the possibility to multiple lines/block comment/ uncomment selected code lines like in AHK-Studio.

This include the selected code between /* */
See screenshot attached.
image

The block is nicely indented and color-highlighted.
One shouldn't need to select the comment block but it will get it from the cursor position and take the block around it.

After an #include any set breakpoint afterwards in same file never stops

Description

After an #include any set breakpoint afterwards in same file never stops.

Reproduction steps

var1 := 1 ; <-- set breakpoint 1
#include myInclude01.ahk
var2 := 2 ; <-- set breakpoint 2

Expected behavior

Debugging with F9 should stop at "breakpoint 1" and "breakpoint 2".

Failure behavior

Stops at breakpoint 1, but does never stop at breakpoint 2.
Seems to be that after an #include any set breakpoint afterwards in same file never stops.

Thanks in advance

Formatting Option Request

Is your feature request related to a problem? Please describe.
Formatting pushes all the expressions/variables to be joined together. However, I personally like variables to be all lined up in a column for easy reading like shown below:
image
I even like aligning all the comments too in a column. It would be great if this could be an option or keybind to format comments/operators to be lined up.
Describe the solution you'd like
Just an option to be set globally in the settings to ignore operators/variables.

Describe alternatives you've considered
I'm not sure where to look in the parser.json to see if I can manually disable this option? If this isn't an option to be considered to be implemented I would love if someone could help me out and manually disabling it.

Cheers,
DMDComposer

Run and Debug button is blank after VSCode update

Issue Type: Bug

After VSCode update the icon on the top right that is used to run a script now presents a white square.

It happens to other extensions as well

Extension version: 2.8.0
VS Code version: Code 1.56.0 (cfa2e218100323074ac1948c885448fdf4de2a7f, 2021-05-04T22:09:06.405Z)
OS version: Windows_NT x64 10.0.19042

System Info
Item Value
CPUs Intel(R) Core(TM) i5-4460 CPU @ 3.20GHz (4 x 3200)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 31.45GB (24.24GB free)
Process Argv D:\Cloud\RaptorX\Dropbox\Isaias\Scripts to Work on\Drip Campaign\Drip --crash-reporter-id e2f4b83e-b638-4515-902d-f6811bd3e786
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
pythonvspyt602:30294772
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt639:30291489
pythontb:30283811
vspre833cf:30267465
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vscorecescf:30290706
pythondataviewer:30285071
vscus158cf:30286554
bridgeflightcf:30299184

New AHK Files From VS Code use the wrong template.

Description

So basically when creating a new ahk file from the winows explorer by right clicking > New AHK File. It all works fine and uses the template for ahk files in "C:\Windows\ShellNew\Template.ahk". However, when I create an ahk file in VS Code it uses this extension's template and not the above mentioned directory. After some digging I found out it's in a json file "C:\Users\This-PC.vscode\extensions\mark-wiemer.vscode-autohotkey-plus-plus-2.8.1\snippets\ahk.json"
I tried changing the code there but I'm really bad at html and json. It worked, then the extension updated and all work was wasted. So I guess I'll have to ask you if you can make the template use "C:\Windows\ShellNew\Template.ahk". Thanks

Reproduction steps

Steps to reproduce the behavior:

  1. Open a folder in VS Code (Control K then Control O and select a folder)
  2. In the explorer window (Control B to toggle it) make a new file and name it anything.ahk
    image
  3. Check the template used which is not what is in "C:\Windows\ShellNew\Template.ahk"
    image

Expected behavior

The extension should use the template in "C:\Windows\ShellNew\Template.ahk"

Additional context

At the start of the json file mentioned above there's a tag or whatever they call it in json which ahktemplate. I think it should be easy to make it use the template.ahk in "C:\Windows\ShellNew\Template.ahk".
image

Thank You!

Add foldable region comments

Hello,

I posted a similar [url=https://stackoverflow.com/q/64791832/14619965]question[/url] on Stack Overflow but it hasn't garnered much interest.

Essentially, I'm trying to determine what the start position is, when the copy command is used, for a selected block of text, preferably using windows cmd/Powershell to be used as a script variable.

BlockSelect

I found this API Reference and wondered if it could be used in some fashion.

Thanks for any help.

Support for AHK V2 syntax

Does this extension support AHK V2 syntax, or is it only V1?
It doesn't seem to support it; the colors get messed up for V2 scripts.

Syntax highlighting for conditional directives

Additional context

From @zaregg in #66

For the code snippet

#If WinActive("ahk_class Notepad") or WinActive(MyWindowTitle)
#Space::MsgBox You pressed Win+Spacebar in Notepad or %MyWindowTitle%.

Currently the syntax highlighting for this #if statement is like this:
image

In the AutoHotkey documentation, however, it's like this:
image

It would be very nice to see this kind of syntax highlighting also implemented in this extension :D

The entire body of a function should be indented

Describe the bug

When formatted, some lines of the demo for v1 function body are not indented:

    objobj := { str: str, obj: obj }
objobjobj := { str: str, int: int, obj: { str: str, obj: obj } }

circular := {}
circular.circular := circular
instance := new Cls()

enum := obj._NewEnum()
}

To Reproduce

Steps to reproduce the behavior:

  1. Go to demos/demo_for_v1.ahk
  2. Format the file
  3. See error around line 40

Expected behavior

When formatted, the entire body of a function should be indented:

    objobj := { str: str, obj: obj }
    objobjobj := { str: str, int: int, obj: { str: str, obj: obj } }

    circular := {}
    circular.circular := circular
    instance := new Cls()

    enum := obj._NewEnum()
}

#IfWinActive Directives auto-format issue

Having multiple #IfWinActive directives causes the formatter to indent all subsequent directives under the last.

#IfWinActive, ahk_exe notepad.exe ; Notepad
    ^w::WinClose
#IfWinActive, ahk_class#32770 ; Windows 10 Properties Panel
    ^w::WinClose
#IfWinActive, ahk_exe taskmgr.exe ; Windows Task Manager
    ^w::WinClose

Will format to:

#IfWinActive, ahk_exe notepad.exe ; Notepad
    ^w::WinClose
    #IfWinActive, ahk_class#32770 ; Windows 10 Properties Panel
        ^w::WinClose
        #IfWinActive, ahk_exe taskmgr.exe ; Windows Task Manager
            ^w::WinClose

Of course, this doesn't make sense because you can't have two windows active at the same time.
Expected behavior: is that this doesn't occur and new directives will maintain their own scope.

[FR] Option to turn off the auto-filling for empty `.ahk` files

Currently, when creating a new .ahk file, after closing and reopening the file, AHK++ will auto-fill it with the following lines:

#SingleInstance, Force
SendMode Input
SetWorkingDir, %A_ScriptDir%

Would be nice to have an option to disable the auto-filling.

Disable Output Window

Please add "Disable Output Window".
This will prevent the Output Window from opening upon an AHK run error.
The user can always Ctrl+Shift+U to open the output window.
Thank you.

Class Support for Outline (Nested Functions within Class declarations)

Outline view shows all functions, even if they are within a Class, but does not group/label by Class.

image

Would be amazing to have the outline handle this!

; Test Class Description
Class TestClass {
    ; __New() - Constructor
    __New() {
        ; Constructor
    }

    ; Simple Test Function
    AFunctionToTest() {
       ; Maybe do something useful.... 
    }

}

HotKey labels not in Outline

Description

HotKey labels arguably are just another sort of label:
image
However, HotKey labels do not appear in the Outline:
image

Formatter indents on ternary operator

Repro

  1. have sth like this code (this is from the original docs just with quotes around the 3)
var := x>y ? 2 : "3"
something("skdfjbv")
  1. Perform Format Document with AHK++ >
var := x>y ? 2 : "3"
    something("skdfjbv")

The exact expression from the docs var := x>y ? 2 : 3 does work properly tho!
It's just when there is a quoted string after the :

Expected behavior
The code should not change.

Environment

VS Code 1.53.0.0
AutoHotkey Plus Plus v2.5.12

Hiding 'Debug AHK Script' Button

Could we get the ability to hide the 'Debug AHK Script' button that sits to the right of the tabs? I linked a picture for reference.

Debug AHK Script Button

Cursor follow not supported

Despite this option being checked, code follow doesn't work in the sidebar Outline.

image

For the record, this is not default behavior in other languages. In C, for instance, if you simply navigate in the editor into a new function block, the outline will dynamically update. This is faster as it requires less intentional double-clicking.

`line <n>` lines should be indented one level more

Describe the bug

In the demo for v1, when formatted, the lines between (LTrim and ) are indented to the same level:

str_multiline := "
(LTrim
line 1
line 2
line 3
)"

To Reproduce

Steps to reproduce the behavior:

  1. Go to demos/demo_for_ahk_v1.ahk
  2. Format the file
  3. See error around line 15

Expected behavior

When formatted, the lines between (LTrim and ) should be indented further, like so:

str_multiline := "
(LTrim
    line 1
    line 2
    line 3
)"

Open related AHK documentation/help

I am looking for a feature to quickly open the documentation page related to the current function or command used in the current editor window.

A hotkey taking for example the function name at cursor location or function used in the current line.

Can Outline include #Include files?

Is it possible for Outliner to read symbols (subs and functions) in #Include references? Would practically replicate the function of TillaGoto in Scite4AHK.

Format document: After "if" statement without brackets a comment is formatted wrong

Description

After "if" statement without brackets a comment is formatted wrong.

Unformatted input snippet

if (true)
; comment
   success = 1
else
   success = 1

Expected formatted output snippet

if (true)
   ; comment
   success = 1
else
   success = 1

Actual formatted output snippet

if (true)
   ; comment
success = 1
else
   success = 1

Thanks in advance

[Bug] `ahk++.run` conflicts with `ahk++.runSelection`

Repro Steps:

When setting both ahk++.run and ahk++.runSelection to the same shortcut, ahk++.runSelection has higher precedence than ahk++.run.

Solution 1:

When there's no selection in the editor, run ahk++.run, otherwise run ahk++.runSelection.

Solution 2:

Add ahk++.ignoreSelection setting (defaults to false), remove ahk++.runSelection command.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.