stef-levesque / vscode-autohotkey Goto Github PK
View Code? Open in Web Editor NEWAutoHotkey language support for VS Code
License: MIT License
AutoHotkey language support for VS Code
License: MIT License
When I click the Run Script play button it pops up an error: command 'ahk.run' not found
when I press the Kill Exe/Script it says: command 'ahk.kill' not found
same with lightning bolt: command 'ahk.run-buffer' not found
I have attempted to disable, enable, uninstall and reinstall. restarting VSCode each time.
Is there something I have done unknowingly? It just stopped working this morning.
It hasn't been touched in years, and several bugs have been fixed by other forks. It may be best for users to know that this extension is deprecated. You could point to my extension, AutoHotkey Plus Plus, as a replacement.
See how to mark extensions as deprecated and my request to deprecate this extension
If you're able to come back to this project, or transfer ownership to someone willing to maintain it (like me 😉) I'll happily rescind the request.
For now, it seems users are not getting a great experience with your extension, and it doesn't look like it'll improve any time soon.
The extension is causing the problem described in this issue each time I start VScode. I disabled my extension one by one to find the culprit. Each time I enabled the AutoHotkey extension, the problem comes back.
Any idea what it could be?
I appreciate the syntax highlighting but would like to be able to disable the snippets. Thanks!
Hey guys. Nice work! Any thoughts on utilizing VSCode's IntelliSense? I'd love to contribute.
Time to implement debugging?
Is it possible to add symbol navigation to vscode-autohotkey, so I can press ctrl+t (default hotkey in VS Code) to navigation to functions and methods of classes?
Or, is that supported already and just not working for me?
(Unfortunately, I don't know how difficult it is to add such symbol navigation support, maybe the amount of work is just to much.)
Not mine, just like the idea of things in one place since the forum isn't as good as it used to be...
I have found a particular class that has its methods and parameters highlighted incorrectly. I cannot seem to determine why though. The method names are being colored like hotkey declarations and the function arguments are all colored as if it is a single string. The class is found here: TreeList
Source included as well:
; TreeList Control Class (v1.0.0)
class TreeList {
Static x64 := A_PtrSize == 8
, TLM_INSERTITEM := 0x401
, TLM_DELETEITEM := 0x402
, TLM_DELETEALLITEMS := 0x403
, TLM_GETITEM := 0x404
, TLM_SETITEM := 0x405
, TLM_GETITEMCOUNT := 0x406
, TLM_GETNEXTITEM := 0x407
, TLM_EXPAND := 0x408
, TLM_SETIMAGELIST := 0x409
, TLM_GETIMAGELIST := 0x40A
, TLM_INSERTCOLUMN := 0x40B
, TLM_DELETECOLUMN := 0x40C
, TLM_SELECTITEM := 0x40D
, TLM_REDRAWWINDOW := 0x40E
, TLM_ISEXPANDED := 0x40F
, TLM_GETCOLUMNWIDTH := 0x410
, TLM_SETCOLUMNWIDTH := 0x411
__new(hWndParent := 0, X := 0, Y := 0, Width := 300, Height := 200, Style := 0x5001000D, ExStyle := 0) {
hMod := DllCall("LoadLibrary", "Str", "rasdlg.dll")
If (!hMod) {
MsgBox 0x10, Error, Failed to load library rasdlg.dll.
Return
}
this.hWnd := DllCall("CreateWindowEx"
, "Uint" , ExStyle
, "Str" , "TreeList"
, "Str" , ""
, "UInt" , Style
, "Int" , X
, "Int" , Y
, "Int" , Width
, "Int" , Height
, "UInt" , hWndParent
, "UInt" , 0
, "UInt" , hMod
, "UInt" , 0, "UInt")
If (!this.hWnd) {
MsgBox 0x10, Error, Failed to create the TreeList control.
Return
}
Ptr := this.x64 ? "Ptr" : ""
this.OldWndProc := DllCall("GetWindowLong" . Ptr, "Ptr", this.hWnd, "Int", -4, "Ptr") ; GWL_WNDPROC
_TreeListHandler(this.OldWndProc, -1, 0, 0)
this.NewWndProc := RegisterCallback("_TreeListHandler", "", 4)
this.OldWndProc := DllCall("SetWindowLong" . Ptr, "Ptr", this.hWnd, "Int", -4, "Ptr", this.NewWndProc, "Ptr")
this.hLV := this.GetListView()
this.hHdr := this.GetHeader()
this.hMod := hMod
WinSet Style, +0x800000, % "ahk_id" this.hLV ; WS_BORDER
}
AddColumn(Text, Width := 100, Align := "", Pos := -1) {
Static fmt := {"Left": 0, "Center": 2, "Right": 1}
VarSetCapacity(LVCOLUMN, this.x64 ? 56 : 44, 0)
Mask := 0x6 ; (LVCF_TEXT := 0x4, LVCF_WIDTH := 0x2)
If (fmt[Align] != "") {
Mask |= 0x1 ; LVCF_FMT
NumPut(fmt[Align], LVCOLUMN, 4, "Int") ; fmt
}
NumPut(Mask, LVCOLUMN, 0, "UInt") ; mask
NumPut(Width, LVCOLUMN, 8, "Int") ; cx
NumPut(&Text, LVCOLUMN, this.x64 ? 16 : 12, "Ptr") ; pszText
NumPut(iImage := 1, LVCOLUMN, this.x64 ? 32 : 24, "Int")
If (Pos == -1) {
Pos := this.GetColumnCount()
}
SendMessage, % this.TLM_INSERTCOLUMN, %Pos%, % &LVCOLUMN,, % "ahk_id" this.hWnd
}
SetColumnText(ColN, NewText) {
VarSetCapacity(LVCOLUMN, this.x64 ? 56 : 44, 0)
NumPut(0x4, LVCOLUMN, 0, "UInt") ; mask (LVCF_TEXT)
NumPut(&NewText, LVCOLUMN, this.x64 ? 16 : 12, "Ptr") ; pszText
SendMessage % A_IsUnicode ? 0x1060 : 0x101A, ColN - 1, &LVCOLUMN,, % "ahk_id" . this.hLV ; LVM_SETCOLUMN
Return ErrorLevel
}
DeleteColumn(ColN) {
SendMessage % this.TLM_DELETECOLUMN, ColN - 1,,, % "ahk_id" . this.hWnd
Return ErrorLevel
}
Add(ParentID := 0, Icon := "", Fields*) {
Mask := Icon != "" ? 0x3 : 0x1 ; LVIF_TEXT = 1, LVIF_IMAGE = 0x2
Text := Fields[1]
VarSetCapacity(LVITEM, this.x64 ? 88 : 60, 0)
NumPut(Mask, LVITEM, 0, "UInt") ; mask
NumPut(0, LVITEM, 4, "Int") ; iItem
NumPut(&Text, LVITEM, this.x64 ? 24 : 20, "Ptr") ; pszText
If (Icon != "") {
NumPut(Icon, LVITEM, this.x64 ? 36 : 28, "Int") ; iImage
}
; TL_INSERTSTRUCT
VarSetCapacity(TVINSERTSTRUCT, this.x64 ? 104 : 68, 0)
NumPut(ParentID, TVINSERTSTRUCT, 0, "Ptr") ; hParent
NumPut(-65534, TVINSERTSTRUCT, this.x64 ? 8 : 4, "Ptr") ; hInsertAfter (TVI_LAST)
NumPut(&LVITEM, TVINSERTSTRUCT, this.x64 ? 16 : 8, "UInt")
iItem := this.Send(this.TLM_INSERTITEM, 0, &TVINSERTSTRUCT) ; this.x64 crashes here
; LV_EX_SetGroup(this.hLV, iItem, 999)
; Sub items
For Each, Field in Fields {
If (A_Index == 1) {
Continue
}
NumPut(iItem, LVITEM, 4, "Int") ; iItem
NumPut(A_Index - 1, LVITEM, 8, "Int") ; iSubItem
NumPut(&Field, LVITEM, this.x64 ? 24 : 20, "Ptr") ; pszText
this.Send(this.TLM_SETITEM, 0, &LVITEM)
}
Return iItem
}
Delete(ItemID := "") {
If (ItemID == "") {
Return this.Send(this.TLM_DELETEALLITEMS, 0, 0)
} Else {
Return this.Send(this.TLM_DELETEITEM, 0, ItemID)
}
}
Select(ItemID) {
Return this.Send(this.TLM_SELECTITEM, 9, ItemID) ; TLGN_CARET
}
Expand(ItemID) {
Return this.Send(this.TLM_EXPAND, 1, ItemID) ; 0 = toggle
}
IsExpanded(ItemID) {
Return this.Send(this.TLM_ISEXPANDED, 0, ItemID)
}
Collapse(ItemID) {
Return this.Send(this.TLM_EXPAND, 2, ItemID)
}
SetImageList(ImageListID) {
Return this.Send(this.TLM_SETIMAGELIST, 0, ImageListID)
}
GetImageList() {
Return this.Send(this.TLM_GETIMAGELIST, 0, 0)
}
GetCount() {
Return this.Send(this.TLM_GETITEMCOUNT, 0, 0)
}
GetColumnCount() {
SendMessage 0x1200, 0, 0,, % "ahk_id" . this.hHdr ; HDM_GETITEMCOUNT
Return ErrorLevel
}
GetColumnWidth(ColN) {
Return this.Send(this.TLM_GETCOLUMNWIDTH, ColN - 1, 0)
}
; LVSCW_AUTOSIZE (-1) Automatically sizes the column.
; LVSCW_AUTOSIZE_USEHEADER (-2): Automatically sizes the column to fit the header text.
; If you use this value with the last column, its width is set to fill the remaining width of the list-view control.
SetColumnWidth(ColN, Width := -1) {
Static AutoSize := {"Auto": -1, "AutoHdr": -2}
If (AutoSize[Width] != "") {
Width := AutoSize[Width]
}
Return this.Send(this.TLM_SETCOLUMNWIDTH, ColN - 1, Width)
}
GetListView() {
Return DllCall("GetWindow", "Ptr", this.hWnd, "UInt", 5) ; GW_CHILD
}
GetHeader() {
SendMessage 0x101F, 0, 0,, % "ahk_id" . this.hLV ; LVM_GETHEADER
Return ErrorLevel
}
GetSelection() {
Return this.Send(this.TLM_GETNEXTITEM, 32, 0)
}
GetRoot() {
Return this.Send(this.TLM_GETNEXTITEM, 0, 0) ; TLGN_ROOT
}
GetChild(ParentItemID) {
Return this.Send(this.TLM_GETNEXTITEM, 2, ParentItemID) ; TLGN_CHILD
}
GetNext(ItemID := "") {
If (ItemID == "") {
Return this.GetRoot()
} Else {
Return this.Send(this.TLM_GETNEXTITEM, 4, ItemID) ; TLGN_NEXT
}
}
GetPrev(ItemID) {
Return this.Send(this.TLM_GETNEXTITEM, 8, ItemID) ; TLGN_PREVIOUS
}
GetParent(ItemID) {
Return this.Send(this.TLM_GETNEXTITEM, 1, ItemID) ; 1 = TLGN_PARENT
}
SetText(ItemID, ColN, NewText) {
VarSetCapacity(LVITEM, this.x64 ? 88 : 60, 0)
NumPut(0x1, LVITEM, 0, "UInt") ; mask (TLIF_TEXT)
NumPut(ItemID, LVITEM, 4, "Int") ; iItem
NumPut(ColN - 1, LVITEM, 8, "Int") ; iSubItem
NumPut(&NewText, LVITEM, this.x64 ? 24 : 20, "Ptr") ; pszText
Return this.Send(this.TLM_SETITEM, 0, &LVITEM)
}
GetText(ItemID, ColN := 1) {
VarSetCapacity(LVITEM, this.x64 ? 88 : 60, 0)
NumPut(0x1, LVITEM, 0, "UInt") ; mask (TLIF_TEXT)
NumPut(ItemID, LVITEM, 4, "Int") ; iItem
NumPut(ColN - 1, LVITEM, 8, "Int") ; iSubItem
VarSetCapacity(pszText, 256, 0)
NumPut(&pszText, LVITEM, this.x64 ? 24 : 20, "Ptr")
NumPut(256, LVITEM, this.x64 ? 32 : 24, "Int") ; cchTextMax
this.Send(this.TLM_GETITEM, 0, &LVITEM)
Return StrGet(NumGet(LVITEM, this.x64 ? 24 : 20, "Ptr"))
}
SetIcon(ItemID, IconIndex) {
VarSetCapacity(LVITEM, this.x64 ? 88 : 60, 0)
NumPut(0x2, LVITEM, 0, "UInt") ; mask (TLIF_IMAGE)
NumPut(ItemID, LVITEM, 4, "Int") ; iItem
;NumPut(ColN - 1, LVITEM, 8, "Int") ; iSubItem
NumPut(IconIndex, LVITEM, this.x64 ? 36 : 28, "Int") ; iImage
Return this.Send(this.TLM_SETITEM, 0, &LVITEM)
}
; Get icon index in the image list
GetIcon(ItemID) {
VarSetCapacity(LVITEM, this.x64 ? 88 : 60, 0)
NumPut(0x2, LVITEM, 0, "UInt") ; mask (TLIF_IMAGE)
NumPut(ItemID, LVITEM, 4, "Int") ; iItem
this.SendMessage(this.TLM_GETITEM, 0, &LVITEM)
Return NumGet(LVITEM, this.x64 ? 36 : 28, "Int")
}
Redraw() {
Return this.Send(this.TLM_REDRAWWINDOW, 0, 0)
}
SetEventHandler(EventHandler) {
_TreeListStorage(this.hWnd, EventHandler)
}
Send(Msg, wParam, lParam) {
SendMessage Msg, wParam, lParam,, % "ahk_id" . this.hWnd
Return ErrorLevel
}
}
_TreeListStorage(hWnd, Callback := "") {
Static o := {}
Return (o[hWnd] != "") ? o[hWnd] : o[hWnd] := Callback
}
_TreeListHandler(hWnd, msg, wParam, lParam) {
Static x64 := A_PtrSize == 8
Static n := {-2: "Click", -3: "DoubleClick", -5: "RightClick", -7: "SetFocus", -8: "KillFocus", -155: "KeyDown"}
Static OldWndProc
If (msg == -1) {
OldWndProc := hWnd
}
If (msg == 78) { ; WM_NOTIFY (0x4E)
hWndFrom := NumGet(lParam + 0)
idFrom := NumGet(lParam + 4)
Code := NumGet(lParam + 0, A_PtrSize * 2, "Int")
If (Code > -7) { ; NM_CLICK, NM_DBLCLK, NM_RCLICK
Row := NumGet(lParam + 0, x64 ? 24 : 12, "Int") + 1 ; NMITEMACTIVATE iItem
Col := NumGet(lParam + 0, x64 ? 28 : 16, "Int") + 1 ; NMITEMACTIVATE iSubItem
} Else If (Code == -155) { ; LVN_KEYDOWN
Key := NumGet(lParam + 0, x64 ? 24 : 12, "Short") ; NMLVKEYDOWN wVKey (key code)
}
Handler := _TreeListStorage(hWnd)
If (Handler != "") {
Event := (n[code] != "") ? n[Code] : Code
%Handler%(hWnd, Event, Row, Col, Key)
}
}
Return DllCall("CallWindowProcA", "Ptr", OldWndProc, "Ptr", hWnd, "UInt", msg, "Ptr", wParam, "Ptr", lParam)
}
Is it planned? Is it even possible? I'd love to help if it can be done.
First of all, thank you for this extension - very useful. Personally, I use it together with Code Runner, which allows me to run AutoHotkey scripts with Alt-Ctrl-N.
However, there is one very annoying thing - UpperCamelCase which is used for quick suggestions:
From my point of view, it will be very useful for a lot of users to have an option to use lowerCamelCase instead.
The main reason to change UpperLowerCase to lowerCamelCase is that it's much easier to type when you write the code outside powerful editor - i.e. your code will be consistent across VS Code and Notepad.
Probably, there is no need to change default behaviour - instead, lowerCamelCase should be implemented as an additional option,
Any plans to change it?
subj
I'm a VS Codium user, a FLOSS version of VS Code, it's the same code but without the Microsoft's telemetry and branding.
I want to request if possible to add the AutoHotkey extension on the open-vsx.org market to us doesn't need to works with the Microsoft marketplace as is unclear if it's legal to use it on VS Code forks, see here.
Additional info:
How to adding function to fold comment like this in .ahk
/*
comment 1
comment 2
...
*/
When this extension is on, it keeps changing characters to "?".
For example, if I write "Vôo" or "Refém", the first time I save, it changes the strings to "V�o" and "Ref�m". The second time I save it changes to "V?o" and "Ref?m".
When I disable the extension this behavior disappears.
In the following line, "{end}" is incorrectly identified as a string. Actually, as a parameter of Send, the text incorrectly identified as a string actually sends double-quote, End key, double-quote (which is the intended behavior), but it is identified and colored as a string (which it isn't). I can't include color in this bug report, and decorating my snippet just made it confusing, so here's the raw text. It should be easy to repro. Thanks for the very useful extension.
F20::Send {Home}"{end}" video game{enter}
now Toggle Line Comment
insert two spaces. like this
; Comment line
0123
Please modify ahk.configuration.json
- "lineComment": "; ",
+ "lineComment": ";",
Issue Type: Bug
the folder cant be found becouse VSC is looking in the wrong directory make an update so we can choose the directory. VSC is looking in C: but the folder it wasnt to get to is in D: and i cant find a way to change the path
Extension version: 0.2.2
VS Code version: Code 1.52.1 (ea3859d4ba2f3e577a159bc91e3074c5d85c0523, 2020-12-16T16:34:46.910Z)
OS version: Windows_NT x64 10.0.19041
Item | Value |
---|---|
CPUs | Intel(R) Core(TM) i5-4460 CPU @ 3.20GHz (4 x 3193) |
GPU Status | 2d_canvas: enabled flash_3d: enabled flash_stage3d: enabled flash_stage3d_baseline: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: disabled_off opengl: enabled_on protected_video_decode: unavailable_off rasterization: enabled skia_renderer: disabled_off_ok video_decode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled |
Load (avg) | undefined |
Memory (System) | 15.95GB (10.20GB free) |
Process Argv | C:\Users\kinder\Desktop\games\roblox game info\divine legacy\R spamm.ahk --crash-reporter-id 370f004d-994a-4ec4-88d5-aa57a7d4d291 |
Screen Reader | no |
VM | 0% |
vsliv368cf:30146710
vsreu685:30147344
openlogontheside:30221877
python763:30178808
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
python504:30227505
vswsl492cf:30211402
wsl2prompt:30224612
pythonvsdeb440cf:30237828
unusedprompt:30224610
folderexplorer:30224614
openfilemenucf:30224648
pythonvsded773cf:30236630
pythonvspyt875:30239451
vsjup459cf:30237188
/*
and*/
symbols can be used to comment out an entire section, but only if the symbols appear at the beginning of a line (…)
https://autohotkey.com/docs/Language.htm#comments
It has quite nasty effect that there is no such thing as /* */
in AHK we are probably used to form other languages:
TTT (text)
/* CCC (comment) */ CCC
/* */ CCC
CCC */ CCC
*/ TTT
When I try to auto indent my .ahk files, I get "There is no formatter for 'ahk'-files installed." IF it does not exist, is there a plan to implement one? How would I go about creating it?
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.