-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New AHK Files From VS Code use the wrong template. #93
Comments
I will likely change the default to #NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir% Don't want to bother people with redundant comments in their templates :) Thank you for teaching me about |
Can you please make it so that it uses template.ahk? It's what I always use (and I have also tweaked it a bit as well to my liking), and what creating an ahk file outside vs code uses. It will make my life easier and not have to go and create a file in windows explorer. Thanks |
@PristineWolf I've just discovered this. Go to You'll be presented with an ahk.json snippets template file which you can edit till your heart's content and should, I assume, persist after extension updates. Using the example below, open a new file, select the AHK language, start typing {
// Place your snippets for ahk here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"MyTemplate": {
"prefix": "#MyTemplate",
"body": [
"#SingleInstance, Force ; Allow only one running instance of script",
"#Persistent ; Keep script permanently running until terminated",
"#NoEnv ; Avoid checking empty variables to see if they are environment variables",
";#Warn ; Enable warnings to assist with detecting common errors",
";#NoTrayIcon ; Disable the tray icon of the script",
"SendMode, Input ; Recommended for new scripts due to its superior speed and reliability",
"SetWorkingDir, %A_ScriptDir% ; Change the working directory of the script",
"SetBatchLines, -1 ; Run script at maximum speed",
"",
"",
]
},
"MyFunction": {
"prefix": "#MyFunction",
"body": [
"Function(){",
"\t$0",
"}",
]
}
} |
Hey, |
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:
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".
Thank You!
The text was updated successfully, but these errors were encountered: