cweijan / autohotkey-plus Goto Github PK
View Code? Open in Web Editor NEWAutoHotkey language support for Visual Studio Code
Home Page: https://marketplace.visualstudio.com/items?itemName=cweijan.vscode-autohotkey-plus
License: MIT License
AutoHotkey language support for Visual Studio Code
Home Page: https://marketplace.visualstudio.com/items?itemName=cweijan.vscode-autohotkey-plus
License: MIT License
Gday
My pull-request with the solution can be found here: #43
Other languages generally have regions folding marked by a comment which starts with the work region
.
This will then be folded up until the corresponding comment beginning with endregion
.
I understand that this might already be implemented elsewhere in your code that i missed, or perhaps it has been left out for a reason (stale request upstream, awaiting official input, awaiting v2 etc etc).
Feel free to ping me if you need any further clarification.
I have provided examples in the Pull Request.
Cheers
Is it possible to show more relevant information about objects?
Try to debug this code for example:
for procData in ComObjGet("winmgmts:").ExecQuery("SELECT * FROM Win32_Process WHERE name = 'explorer.exe'")
{
cmd := procData.CommandLine
OutputDebug cmd: %cmd%
}
Expected: commandLine value as well as all the fields from the link below are shown in a list of variables of the procData variable:
https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-process
Actual: four items are shown (Value, VarType, DispatchType, DispatchIID).
I tried add 'args' section in launch.json, but didn't work. How can I set startup arguments?
try to format this:
InputBox, name, for bla
if somthing
Return
it will turn to:
InputBox, name, for bla
if somthing ; << indentation added!
Return
There is actually no change expected.
It seems to be triggered on the for
keyword!
Version: 1.48.0-insider (system setup)
Commit: 731f9c25632dbbf01ee3a7892ad9d2791fe0260c
Date: 2020-07-24T05:57:10.466Z
Electron: 9.1.0
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Windows_NT x64 10.0.17134
AutoHotkey Plus 2.4.14
First time using your extension, so I'm not sure if this is an issue or I didn't set it up right. I can Run/Compile the script from the context menu, but debugging doesn't seem to work. I'm not sure if I needed a separate debugger, but I figured it would have been mentioned somewhere.
Please see ...
a.ahk 运行依赖同目录下的 b.ahk,直接运行 a.ahk报错。
previous:
current:
theme: https://marketplace.visualstudio.com/items?itemName=GitHub.github-vscode-theme
Hi, when I select a function name and click on Go to definition, for some reason it's going to the same function defined in a different file altogether instead of going to the function definition in the same file.
Also, for some reason not all the functions defined are shown in the outline sidebar, if this can be fixed it would be great.
In my script I have function definition, labels, hotkeys all mixed and are not put in any sequence, if that causing this outline issue?
Also, in Outline, all the variable and stuff is also shown, if outline can be only for the functions that would be great!
Thanks for your effort!
Apparently it doesn't work using AHk version 1.1.32.00, I did a clean installation of Windows 10 + AHK 1.1.32 + VSCODE and its extension and after trying to do a hello world it is observed that it does not recognize the default interpreter.
The path is valid, I check and I configure follow the instructions.
For denoting the end of a subroutine the return
keyword prevents further indentation while the same is not true for ExitApp
.
This causes lines beneath to indent as if it is part of the same subroutine and also has some weirdness with comment blocks.
You can add a return
below to prevent the issue but that seems redundant.
Edit: Weirdly, the return
statements within functions seem to lose indentation. I'll make a new issue if need be but it seems relevant. Looking into it, this seems to occur beneath any multi-line label, hotkeys, and hotstring perhaps due to the open colon :
syntax?
Sample: The same issue doesn't occur with ExitApp
or the single line hotkey f1::send, foo
; Uncommenting any has the same effect for me
; :::fdate:: ; 2015-12-31 (for file or folder names)
; FormatTime, DateString,, HH-mm-ss
; send, % DateString
; Return
; f1::
; send, foo
; return
; label:
; msgbox, test mesage
; return
testFunction2() {
msgbox, "I'm a test function!"
return
}
testFunction() {
msgbox, "I'm a test function!"
ExitApp
}
By Google Translate from Japanese to English.
The conditions are as follows.
demo_for_ahk_v2
instance: = new Cls()
Then the following error message is displayed.
Command failed: "C:\Program Files\AutoHotkey\v2-alpha\x64\AutoHotkey.exe" /debug=localhost:9001 "W:\project\vscode-autohotkey/demos/demo_for_ahk_v2.ahk"
抱歉,我也遇到了运行路径的问题
我的项目路径为:
second.ahk
is included by main.ahk
. The content of main.ahk
is as follows:
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#Include, second.ahk
MsgBox, Hello
点击 Run 按钮,报错如下:
E:\OpenSourseProject\ahk-project\main.ahk (6) : ==> #Include file "e:\OpenSourseProject\second.ahk" cannot be opened.
但是在文件夹里双击 main.ahk
是可以正常运行的。
把 include 的内容改成 %A_ScriptDir%/second.ahk
的话点击 Run 才能正常运行,请问我是有哪一步做错了吗?
我打开项目的方式是:
打开 ../opensourceproject/ahk-project/
路径,右键文件夹空白处,选择 通过 code 打开
谢谢大佬的插件!!!
Thanks for this great project, I use it with pleasure!
I have the following function:
RandomSleep(timez:=300, rand:=-1) {
; some code here
}
If I call this function anywhere in the code and try to go to its definition with F12 or Ctrl + Click, it doesn't work. It say that definition is not found.
If I remove the -
character from rand
it works. This works:
RandomSleep(timez:=300, rand:=1)
Very strange.
And for this one I cannot get Go To Definition work even if I remove both - from the definition:
DeltaTickS(FirstTick:= -1, SecondTick:= -1){
if (FirstTick = -1)
FirstTick:= A_TickCount
if (SecondTick = -1)
SecondTick:= A_TickCount
return ((FirstTick - SecondTick) // 1000)
}
Creating an empty DeltaTicksS() { }
works though. Even highlighting the definition of my original function and pressing F12 takes to this new empty function.
The GoTo Definition and Find References searches in all files in a folder and not only in the included files.
In my case the GoTo Definition shows the "wrong" function, I assume, because it finds this not included files first in the folder which happend to contain a function with the exact same name.
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;
---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.
Hi,
for a couple of weeks now - looks like since one of the latest updates in May or June 2020 - I cannot run my AHK script anymore using VSC and the "Run" feature. My AHK script uses #include
statements. The error in the debug console looks like:
#Include file "..." cannot be opened.
Using AutoHotKey directly on the script by right click and Run Script
it works.
Thanks for sime ideas, what I'm doing wrong.
vscode 1.51.1 / vscode-autohotkey 2.60 / ahk 1.1.33.02
#Requires AutoHotkey 1.1.33+
#Warn All
#SingleInstance Force
#NoEnv
SetWorkingDir %A_ScriptDir%
SetBatchLines -1
array := {}
; --- Something strange
; array[99] := "some value"
; array[100] := "now see debugger"
; Debugger show:
; ...
; array: Array(100) <-- ? incorrect array size ?
; [99]: some value
; [100]: now see debugger
; ...
; --- Something strange
array[100] := "some value"
array[101] := "now see debugger"
; Now debugger show:
; ...
; array: Array(101)
; [0..99]
; [1]: some value
; [2]: now see debugger
; [100..100]
; ...
Is this feature not enabled?
VS Code Version: 1.54.3 (user setup)
OS: Windows_NT x64 10.0.19042
AHK Version: 1.1.33.06
When hovering any method call or command the hover tip is not displayed.
Apparently, there is something related to the tryGetSnippetHover function. If the MarkdownString
constructor is called with an empty string as initial value, rather than null
, the hover tip works as expected.
[2021-03-18 13:16:40.856] [exthost] [error] [cweijan.vscode-autohotkey-plus] provider FAILED
[2021-03-18 13:16:40.856] [exthost] [error] Error: Illegal argument: value
at Object.k [as illegalArgument] (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:5:1232)
at new C (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:60:18047)
at new s (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:81:27213)
at new s (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:81:11705)
at AhkHoverProvider.tryGetSnippetHover (c:\Users\joels\.vscode\extensions\cweijan.vscode-autohotkey-plus-2.6.2\out\providers\ahkHoverProvider.js:46:29)
at AhkHoverProvider.<anonymous> (c:\Users\joels\.vscode\extensions\cweijan.vscode-autohotkey-plus-2.6.2\out\providers\ahkHoverProvider.js:24:39)
at Generator.next (<anonymous>)
at c:\Users\joels\.vscode\extensions\cweijan.vscode-autohotkey-plus-2.6.2\out\providers\ahkHoverProvider.js:8:71
at new Promise (<anonymous>)
at __awaiter (c:\Users\joels\.vscode\extensions\cweijan.vscode-autohotkey-plus-2.6.2\out\providers\ahkHoverProvider.js:4:12)
at AhkHoverProvider.provideHover (c:\Users\joels\.vscode\extensions\cweijan.vscode-autohotkey-plus-2.6.2\out\providers\ahkHoverProvider.js:22:16)
at c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:87:156761
at c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:57:7538
at new Promise (<anonymous>)
at Object.g [as asPromise] (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:57:7510)
at n.provideHover (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:87:156732)
at c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:87:179262
at Se._withAdapter (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:87:176060)
at Se.$provideHover (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:87:179238)
at c._doInvokeHandler (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:90:10509)
at c._invokeHandler (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:90:10201)
at c._receiveRequest (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:90:8820)
at c._receiveOneMessage (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:90:7673)
at c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:90:5782
at g.fire (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:57:1836)
at p.fire (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:65:15443)
at c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:106:29119
at g.fire (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:57:1836)
at p.fire (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:65:15443)
at t._receiveMessage (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:65:20693)
at c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:65:17587
at g.fire (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:57:1836)
at l.acceptChunk (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:65:12808)
at c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:65:12156
at Socket.E (c:\Users\joels\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:106:12375)
at Socket.emit (events.js:315:20)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:271:9)
at Socket.Readable.push (_stream_readable.js:212:10)
at Pipe.onStreamRead (internal/stream_base_commons.js:186:23)
兄弟你写的插件很棒,能否增加outline里对中文的标签和函数支持,还有热键的支持
能否设置run ahk script 前先保存文件再运行,辛苦了
Hi, love your extension, I've been using it for a couple of days.
Today, I could not debug my ahk scripts any longer.
Pls see attached screenshot - debugger is no longer showing vars or stopping at breakpoints.
https://i.imgur.com/DWfXn5T.png
Tried reinstalling VSCode, deleting extensions folders, reinstalling them.
This is a curious issue. I discovered that breakpoints aren't being obeyed on source files that are added to a OneDrive folder in Explorer. This took a while to discover the culprit!
If I simply drag that file out of the folder and into a non-OneDrive folder... magic. Breakpoints break as they should.
Setting the indent for AutoHotkey files to anything else than 4 spaces fails.
Recreate: Set indent to 2 spaces.
Expected result: Indenting 2 spaces.
Preferred solutions:
1. Use the indent settings for the file type. , or..
2. Make an extension setting for it.
// Big thanks for a nice extension!
Minimal reproduction. Uncomment ; Breaks formatting
sections and save to see the issue in action.
Example:
#IfWinActive Notepad
; Breaks formatting
; $^1::
; Foo := 1
; Bar()
; return
; Breaks formatting
; $^`::
; Foo := 1
; if Foo {
; Bar()
; } else {
; Fizz()
; }
; return
Bar() {
return
}
Fizz(){
return
}
为什么不考虑增加在右键菜单运行脚本前先保存文件
One of the best feature for me is running temporary scripts, without needing the save them.
Since 2.5.5 whenever I run or compile unsaved scripts a Save As window comes up and interferes with the running process.
Version 2.4.4.
Installed previous 2.4.3 - fixed.
By Google Translate from Japanese to English.
If you start debugging in the following way, it will fail.
Curiously, if you open and close the file set in "program" and start debugging, it works fine.
Hello. Thanks a lot for the great extention.
If I run the script which was not opened in the VSCode editor (editor tab is not active or even closed) then the debug panel appears, but the script is not started. If I restart Debug with corresponding command then script runs, but no breakpoints are activated.
There is no issues if I start the debug when the script is opened in the editor.
I don't know what I'm doing wrong.
Here is my "launch.json":
{
"version": "0.2.0",
"configurations": [
{
"type": "ahk",
"request": "launch",
"name": "Autohotkey Debugger",
"program": "${workspaceFolder}\\main.ahk",
"stopOnEntry": true
}
]
}
The ${workspaceFolder} is like C:\Users\%UserName%\AAA\BBB\CCC.ahk
Would you help me, please?
Would be great to open the help file AutoHotkey.chm from within VSCode.
OS: Windows 10 Pro 64 bit
AHK: 1.1.33.2
Installation Path: C:\Program Files\Other\AutoHotkey
My copy of AHK is installed in a non-default location.
At the moment vscode-autohotkey installs (apparently) ok, but then fails the first time you try to run or debug a script.
Ideally the installation process for the extension would check the file path to the AHK executable and help file, give a meaningful warning then open the settings page so the user can set the correct paths.
If that isn't possible, a helpful message from the first attempt to run a script in the debugger, rather than a plain The system cannot find the path specified.
error would be an improvement.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.