Skip to content

CoffeeChaton/vscode-autohotkey-NekoHelp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vscode-autohotkey-NekoHelp

Base of cweijan /vscode-autohotkey
Base of regexp match, not the principles of compilation, so parser inaccurate.
AutoHotkey v2 has been released and will be considered the default/main version announcement, if you need to write new ahk, I suggest you to use ahk v2 && AutoHotkey v2 Language Support, ahk v1 for me is so complicated.

AutoHotKey v1 edit-support for VS Code

Install

  1. Install extension via Visual Studio Marketplace AutoHotkey NekoHelp.
  2. Install .vsix from my github https://github.com/CoffeeChaton/vscode-autohotkey-NekoHelp/releases

Youtube

vsc-ahk-neko-help

  1. support unicode (utf-16 Plane 0), look unicode-support
  2. 4K 30sec
    1. across files information
    2. SignatureHelp
    3. Completion
    4. unicode support
  3. (4k 90-sec)https://youtu.be/WcMzNcVWcYA
    1. sign of user-def param is variadic case
    2. sign of nested function case.

FunctionSymbol

  1. Detect source Function as symbol
  2. support continuation at Outline.

CodeSymbol

  1. You can add two semicolon ;; at line first.
  2. You can see Leveled outline
  • class
  • function
  • switch, Case, Default
  • Labels, like this_is_a_label:
  • HotString, like ::ahk::
  • HotKeys, like ~F12::
  • directive, like #Include or #Warn

GotoDefinition

  1. Go to Definition (default via F12 or Ctrl+Click)
  2. open the definition to the side with (default via Ctrl+Alt+Click )
  3. Peek Definition (default via Alt+F12)
  4. Go to Symbol (default via Ctrl+T) GotoDef

    ↪ Go to Definition (default via F12 or Ctrl+Click)

Find All References support

  1. Go to References (default via Shift+F12)

  2. Find All References (default via Shift+Alt+F12)

    ListAllReferences

    🔍 Find All References (default via Shift+F12)

Find Ref of Function

support to find like

  1. functionName( , call function, but does not contain like new ClassName()

  2. "functionName" , wrapped in text, Warning, refactoring may accidentally modify such references.

    some exp code
     #NoEnv
     #Warn All
     SetControlDelay, 0
    
     ~F9:: fn_exp(["fnA","fnB"])
     ~F10:: fn_exp(["fnB","fnA"])
    
     fn_exp(fnList){
         For _Key, fn in fnList {
             funcOnj := Func(fn)
             funcOnj.Call()
         }
     }
    
     fnA(){
         MsgBox, % "i am fnA"
     }
    
     fnB(){
         MsgBox, % "i am fnB"
     }
  3. label -> function https://www.autohotkey.com/docs/v1/misc/Labels.htm#Functions

  4. Sort F-flag https://www.autohotkey.com/docs/v1/lib/Sort.htm#Options

    MyVar := "5,3,7,9,1,13,999,-4"
    Sort, MyVar, F IntegerSort D,
    ;              ^^^^^^^^^^^ func after F[ \t]
    MsgBox, % "MyVar is " MyVar
    
    IntegerSort(a1, a2)
    {
         return a1 - a2
    }
  5. RegEx CallOut Functionshttps://www.autohotkey.com/docs/v1/misc/RegExCallout.htm#callout-functions
    or (?CNumber:Function) https://www.autohotkey.com/docs/v1/misc/RegExCallout.htm#auto

    Haystack := "The quick brown fox jumps over the lazy dog."
    RegExMatch(Haystack, "i)(The) (\w+)\b(?CCallOut)")
    ;                                       ^^^^^^^ func in (?CFuncName)
    CallOut(m) {
        MsgBox ,
            (LTrim C
                m=%m% ;  m=The quick
                m1=%m1% ;m1=The   ; m1 is Pseudo-Arrays https://www.autohotkey.com/docs/v1/misc/Arrays.htm#pseudo
                m2=%m2% ;m2=quick ; m2 is Pseudo-Arrays also
            )
        return 1
    }
  6. not plan to support like %func%() Func%A_Index%() Dynamically Calling a Function

  7. warn this extension not match case

    var := "name"
    fn%var%()
    
    fn := "fn"
    %fn%%var%()
    str = fnName ; not use := && ""
    func(str).call()
    
    fnName(){
         MsgBox % "i am fnName"
    }
  8. read more of funcRef

Function rename

  • (default via F2) rename with your can use [🔍Find Ref of Function] to find.
  • check of Rename newName
    1. check newFnName has been defined as function class label
    2. default not rename "fnName" , can use AhkNekoHelp.Rename.functionInStr open it [Read more]
    3. warn this extension not match fn%var%() or %fn%%var%() or str = fnName case

Hover

  • Hover to view details on variables, function, command
  • Over 200 Command and Function documenting built-in
  1. Hover function to show return value or comment

  2. add comment of function

    /**
     * - in /** block.
     * - and the line first character is '*' or ';'
     * - can use partial grammar of markdown.
     * - exp@email.com
     * - [Markdown Rule](https://en.wikipedia.org/wiki/Markdown)
     * - <https://en.wikipedia.org/wiki/Markdown>
     * ![Image](/D:/icon.png "icon")
     * ~~ABC~~
     * _ABC_ _ABC_
     * - - -
     *  `monospace`
    */
    fn(param){
        ; some code
    }
  3. add jsdoc-style comments of variable img

    f2(){
        /**
        * - [markdown-syntax](https://www.markdownguide.org/basic-syntax/)
        * - list2
        * - Love **is** bold
        *
        * style look like jsDoc
        * and you need write before at var first-def line
        */
        style1 := 0
    
        MsgBox, % style1 ; try to hover of "style1"!
    
        style2 := 1 ; i look like c++ doc style
        MsgBox, % style2 ; try to hover of "style2"!
    }
  4. CLSID hover (youtube 4K 1min)

Diagnostic and lint

⚠️ Diagnostics/Warnings over 30 ruler

  1. warning about use = not := to assign.

  2. warning of Switch
    Case : not find

  3. use ;@ahk-neko-ignore [number] line. to ignore,
    exp:

    ;@ahk-neko-ignore 1 line
    ;@ahk-neko-ignore 2 line
    ;@ahk-neko-ignore 999 line
    
    ;@ahk-neko-ignore-fn 1 line
    ;@ahk-neko-ignore-fn 2 line
    ;@ahk-neko-ignore-fn 999 line
    
     ;use 0 to open diag
     ;@ahk-neko-ignore 0 line
     ;@ahk-neko-ignore-fn 0 line

Format

  1. Right click then click format document.

  2. or alt + shift + f

  3. format switch case

  4. read more exp note/ahk/format

  5. other setting

    ;
    ;@ahk-neko-format-ignore-start
    ;@ahk-neko-format-ignore-end
    ;@ahk-neko-format-inline-spacing-ignore-start
    ;@ahk-neko-format-inline-spacing-ignore-end
    /*@ahk-neko-format-ignore-block
         ^ I think this will reduce the interference with git-diff.
    */

SignatureHelp

  • Not yet supported functions-used not in a line case.

  • Signature of user-def-function youtube 4k 90-sec

  • Signature of built-in function

  • Signature of command img

  • calc [] and {} , at function arguments. img

ColorProvider

img

ColorProvider.md

IntelliSense

1. Snippets of your function

IntelliSenseFunc

2. Completion of function variables

Completion_of_function_variables.gif

3. Completion of #Include

Completion of Include

4. Completion of class

Completion of class

5. Snippet Completions for @param Doc Tags

Completion of @param

6. VBA++ with ComObjActive()

alt text #69

Targeted assistance

1. ErrorLevel quick add Template and hover

{ // settings.json
    "AhkNekoHelp.customize.CodeActionAddErrorLevelTemplate": [
        "if ErrorLevel ;$1",
        "{",
        "    $0",
        "}",
        ""
    ]
}

ERROR

ERROR hover

#60

2. hover MsgBox magic number

MsgBox-hover.png

#73 #58

3. add Gui name

alt text

ListAllFunctions

  1. click the button bar XXX.ahk
  2. list all func ListAllFunctions

Better highlight

of Legacy assignment

semantic-highlight of MyString = This is a literal string. equal sign operator (=)

__legacy_assignment img

of Numbers

img

theme from One Dark Pro

  • 0x and e use keyword.other.unit

  • other number ex 123 007B 3.14159 use constant.numeric

  • exp of your settings.json ReadMore of highlighting

  • Source code

    settings.json
    // settings.json
    {
        "editor.tokenColorCustomizations": {
            "textMateRules": [
                {
                    "scope": "keyword.other.unit.numeric.hexadecimal.ahk",
                    "settings": {
                        "foreground": "#E06C75"
                    }
                },
                {
                    "scope": "keyword.other.unit.numeric.decimal.ahk",
                    "settings": {
                        "foreground": "#E06C75"
                    }
                },
                {
                    "scope": "constant.numeric.hexadecimal.ahk",
                    "settings": {
                        "foreground": "#D19A66"
                    }
                },
                {
                    "scope": "constant.numeric.decimal.ahk",
                    "settings": {
                        "foreground": "#D19A66"
                    }
                }
            ]
        }
    }

of ahk2exe

img1

  • feat: the @Ahk2Exe of ;@Ahk2Exe-XXX provide semantics as "other.customize.keyword.comment.ahk2exe.ahk"

    other-style
    // settings.json
    {
        "editor.tokenColorCustomizations": {
            "textMateRules": [
                {
                    "scope": "other.customize.keyword.comment.ahk2exe.ahk",
                    "settings": {
                        "foreground": "#C678DD"
                    }
                }
            ]
        }
    }

    img2

    #12 (comment)

Quick Log Msg

default via ctrl+alt+l

// settings.json
{
    "AhkNekoHelp.customize.displayLogMessage": "MsgBox % \"♥ ~ {selectText} \" {selectText} \" at \" A_ThisFunc"
}

Privacy Statement

  • Do not upload any information.
  • only use vscode provided api, not any third party dependencies, Safe and Privacy.
  • just scan workspaces or open file. not auto scan any file without workspaces, until option the "AhkNekoHelp.file.tryParserInclude" or "AhkNekoHelp.files.alwaysIncludeFolder"
  • If you need to place .ahk in other folders, this Extensions support Multi-root Workspaces or "AhkNekoHelp.files.alwaysIncludeFolder"

Performance

  • The best way to improve startup times is to exclude unnecessary files, via settings.json AhkNekoHelp.files.exclude

  • When editing becomes slow, split the file, via #Include

  • via 'Refresh Resource' to find each file parsing time.

Credits

otherSuggest