Visual Studio Code Support

Discuss features, issues, about Editors for AHK
haichen
Posts: 134
Joined: 09 Feb 2014, 08:24

Visual Studio Code Support

31 Dec 2015, 07:13

After the nice work with Atom, i thought it would be also nice to run AutoHotkey from Visual Studio Code. I found an extension for syntax highlighting and here is how i got it working:

In VSC type
1. strg+p
2. ?
3. klick ext install
4. type autohotkey

klick on install

After restart of VSC it says there is an issue with this extension.
But nevertheless i could get it working by downloading the extension from
https://github.com/stef-levesque/vscode ... master.zip
Then i copied the files in the zip in the VSC extension dir:
C:\Users\user\.vscode\extensions\slevesque.vscode-autohotkey-0.0.1
After a restart i got the syntaxhiglighting.

At second i wanted to run a script from VSC. After searching i tried the extension "Runner" from
Yasuhiro Matsumoto

As above type
1. STRG+P
2. ?
3. klick ext install
4. type runner

klick on install

After this you have to open the menu File>Preferences>User Settings.
This menu shows the Default Settings at the left and the file settings.json at the right where you have to copy

Code: [Select all] [Download] GeSHi © Codebox Plus

{
"runner.languageMap": {"autohotkey": "C:/Program Files/AutoHotkey/autohotkey.exe"},
"runner.extensionMap": {"ahk": "autohotkey"},
}


After saving try to run (STRG+SHIFT+R) a test.ahk with



You get the text in an ouput column in VSC.
Zeb

Re: Visual Studio Code Support

28 Sep 2016, 05:40

Even tho this Post is probably too old to hope for a reply but I can't get it to execute my scripts. It says "autohotkey" was either wrong written or couldn't be found.
haichen
Posts: 134
Joined: 09 Feb 2014, 08:24

Re: Visual Studio Code Support

30 Sep 2016, 02:51

I saw it yesterday. Meanwhile I've a new pc. So I had to to install VSC and try my own Tip. But it also didn't work for me and until now I found no solution. Sorry!
Zeb

Re: Visual Studio Code Support

25 Oct 2016, 08:54

Well after checking the source-code of the extension and not finding anything suspicious... I simply tried out the fullpath for the autohotkey.exe plus double-double-quotes, which does the job.
Seems kind-of stupid but I don't care as long as it works that way.

Code: [Select all] [Download] GeSHi © Codebox Plus

{
"runner.languageMap": {"autohotkey": "C:/Program Files/AutoHotkey/autohotkey.exe"},
"runner.extensionMap": {"ahk": ""C:/Program Files/AutoHotkey/autohotkey.exe""},
}
haichen
Posts: 134
Joined: 09 Feb 2014, 08:24

Re: Visual Studio Code Support

25 Oct 2016, 11:59

oh wow, very strange! Thank you very much for finding this!!
momo2000
Posts: 29
Joined: 25 Jan 2015, 12:00

Re: Visual Studio Code Support

11 Nov 2016, 08:44

Trying to get VSC working with AHK as well. Syntax highlighting works, but the Run/debug feature does not. I followed the steps above (and put those two lines in the settings.json file) but not working. When I got to run/debug, I get the error "Cannot find runtime 'node' on PATH." Any ideas?
mh1723
Posts: 1
Joined: 08 Jan 2017, 21:47

Re: Visual Studio Code Support

08 Jan 2017, 22:03

I am very new to all this but very interested in also setting it up. Every time I have come across a not found in PATH type issue it stems from not having one file or another properly set in the system environmental variables. From the System window or right click start button->system->advanced system settings->Environment Variables. Include the paths for everything AHK related.

At times I have had to go down a few levels in a directory and select another folder in order for it to pick it up correctly.
haichen
Posts: 134
Joined: 09 Feb 2014, 08:24

Re: Visual Studio Code Support

10 Feb 2017, 08:35

I tried another try to get "runner" to run but failed.

So i now try another "Code Runner". This Extension works and so want to share it with you.

https://marketplace.visualstudio.com/it ... ode-runner

Installation:
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
ext install code-runner

After Installation you have to add the following to the menu File>Preferences>User Settings
(You may leave or change all other "executors" from the example but i take here only autohotkey related):

Code: [Select all] [Download] GeSHi © Codebox Plus

{
"code-runner.executorMap": {
"autohotkey": "\"C:\\Program Files\\AutoHotkey\\AutoHotkey.exe\"",
},
"code-runner.defaultLanguage": "autohotkey",
"code-runner.executorMapByFileExtension": {
".ahk": "\"C:\\Program Files\\AutoHotkey\\AutoHotkey.exe\""
}
}


Right click - "Run Code" and autohotkey runs the whole script or the marked text.
Stenemo
Posts: 3
Joined: 25 Dec 2015, 04:48
Facebook: Stenemo
GitHub: MarkusStenemo

Re: Visual Studio Code Support

23 Apr 2017, 05:53

Are there any ongoing projects to make this available for Visual Studio 2017 as well?

Return to “Editors”

Who is online

Users browsing this forum: No registered users and 0 guests