Page 1 of 1

Autohotkey editor for vscode

Posted: 25 Mar 2020, 07:17
by cweijan
I developed a vscode plugin that supports debugging ahk script and hope to be helpful to ahk amateur.
It's support debug(breakpoint,step run, variable view)„ÄĀsymbol detacher in vscode
more detail:https://github.com/cweijan/vscode-autohotkey

Re: Autohotkey editor for vscode

Posted: 27 Mar 2020, 14:44
by Haswell
Well done!
Looks awesome!
I'm using it right now and it's perfect!
I've been missing it for a long time!

I have two questions although not about debugging:
1. How do you create such a marvelous gif-file?
2. If you work with vscode you may know how to use suggestions.
When I start typing "outp" a suggestion appears with command "OutputDebug".
I choose it by pressing tab.
And here is what I see:
Image

I get a silly command:
Image

When I proceed typing, for instance, text literal "hello" and here is what I get:
Image

After that I need to remove sight %
Not to mention multiple items of the same sugggestion in the list..

Doesn't everybody suffer from this bullshit?
Such a suggestion doesn't help me at all and even forces me to put more effort and time to correct it each time I use it.
Anybode knows how it is supposed to be used? :crazy:
Or how to disable this annoying behaviour?

Re: Autohotkey editor for vscode

Posted: 28 Mar 2020, 12:23
by haichen
You find the snippets here:
C:\Users\<user>\.vscode\extensions\cweijan.vscode-autohotkey-plus-2.2.0\snippets\ahk.json
and then you can certainly adapt them to your needs.

Re: Autohotkey editor for vscode

Posted: 29 Mar 2020, 04:33
by Haswell
Thank you so much.
It looks like what I exactly need.
Won't my changes be overwritten during the next release of the extension?

Re: Autohotkey editor for vscode

Posted: 29 Mar 2020, 07:00
by haichen
https://code.visualstudio.com/docs/editor/userdefinedsnippets#_create-your-own-snippets

You can copy and adjust snippets from the extension to your own snippet file. Or create your own snippets.
"select User Snippets under File > Preferences "

Re: Autohotkey editor for vscode

Posted: 29 Mar 2020, 07:29
by haichen
This could be an example for your own snippetfile:
C:\Users\<user>\AppData\Roaming\Code\User\snippets\ahk.json

Code: Select all

{
	"OutputDebug": {
		"prefix": "OutputDebug",
		"body": "OutputDebug, ${1:Text}${2: % }$3",
		"description": "haswells version: Sends a string to the debugger (if any) for display."
	}
}

Re: Autohotkey editor for vscode

Posted: 31 Mar 2020, 15:00
by GTM
Hello

Ive been using this plugin but not the debugging/running. At first a little while ago it wouldnt load my file cause my directory had a space.

Now I have tried and Im finding that my script isnt actually running. I have no breakpoints or anything set, and it seems like it stalls at different parts, like every time I hit run and then press my hotkeys i get a different behaviour.

I've spent some pretty good time analyzing the textmates because Im making a theme and have been working in AHK a lot recently (im not very good). Ive noticed that there is a "source.ahk functionline.ahk string.function.arguments.ahk", textmate, but I can only get it to appear SOMETIMES. I havent quite figured out the logic behind it, but sometimes its a matter of having the opening { on the same line as the function, but other times it doesnt seem to make a difference. One thing I dont like about it when it does work is that it converts all the text in the function line, punctuation, byref (keyword.other) into the same color.

Also wondering what you have planned for formatting? sometimes I seem to get some strange results. From what I have learned it seems that preparing a function like

Code: Select all

thisIsMyFunction(arg1, arg2..)
{
code
}

Rather Than
thisIsMyFunction(arg1, arg2..)  {
code
}
Because it seems to give the best results, but then I have two functions I am looking at right now which have the { on the opening line but they look like

Code: Select all

chunkExpander(virginChunkChars, numCharsToExpandTo, disableDev := true) {
while (strlen(virginChunkChars) < numCharsToExpandTo)                           ;no indent
    virginChunkChars .= virginChunkChars                                        ;no indent
virginChunkChars := substr(virginChunkChars, 1, numCharsToExpandTo)             ;no indent
return virginChunkChars
}   ;------------------------------------------------------------------------------------------>

sumOfChunks(lineOfChunks) {
    sum := 0
    loop, % lineOfChunks.maxindex()
        if !(instr(lineOfChunks[A_Index, 2], "rF") || instr(lineOfChunks[A_Index, 2], "rH"))
        sum += lineOfChunks[A_Index, 3]                         ;no indent
    return sum
}


Anyway, keep up the good work, I noticed youve been working really hard lately.

Maybe if you dont mind, and if I can figure out how to create an extension, I could try and see if I can do anything to tighten up the text mates, refine the scopes and bring some of them more in line with other genreal languages? I dont expect to do any better but Im willing to try.