Is your feature request related to a problem? Please describe.
Kinda. People often find it difficult to write Declare statements with certainty that they are correct. I have frequently accidentally written a function signature with some param which was meant to be a Integer but I accidentally wrote Long. With VBA Pro we could eventually add a quick-fix option, much like they do in other languages like python and typescript which brings auto-imports into the main import section of the module.
Describe the solution you'd like
Say the user writes GetWindow, we can flag the error that GetWindow is not defined. It would be great to add a Quick Fix option to import from user32. Upon choosing this option:
Private Declare PtrSafe Function GetWindow Lib "user32" (ByVal hwnd As LongPtr, ByVal wCmd As apiWindowRelationship) As LongPtr will be added to the VBA7 section
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As LongPtr, ByVal wCmd As apiWindowRelationship) As LongPtr will be added to the < VBA6 section
Enum LongPtr added if undefined to VBA6 section
Enum for apiWindowRelationship added to the declare section
I anticipate this feature is pretty far off, but just wanted to add it while I thought of it.
We'll probably need some repository of Enums, DLLs etc. in some JSON format. Or perhaps more ideally generated from the win32 metadata
I like it, but it's definitely on the backlog. And I agree, a repository of some sort would probably be the way to manage it. I think it'll be behind adding the object model / code completion and fixes for that.
Is your feature request related to a problem? Please describe.
Kinda. People often find it difficult to write
Declare
statements with certainty that they are correct. I have frequently accidentally written a function signature with some param which was meant to be aInteger
but I accidentally wroteLong
. With VBA Pro we could eventually add a quick-fix option, much like they do in other languages likepython
andtypescript
which brings auto-imports into the main import section of the module.Describe the solution you'd like
Say the user writes
GetWindow
, we can flag the error thatGetWindow
is not defined. It would be great to add aQuick Fix
option to import fromuser32
. Upon choosing this option:Private Declare PtrSafe Function GetWindow Lib "user32" (ByVal hwnd As LongPtr, ByVal wCmd As apiWindowRelationship) As LongPtr
will be added to the VBA7 sectionPrivate Declare Function GetWindow Lib "user32" (ByVal hwnd As LongPtr, ByVal wCmd As apiWindowRelationship) As LongPtr
will be added to the < VBA6 sectionLongPtr
added if undefined to VBA6 sectionapiWindowRelationship
added to the declare sectionI anticipate this feature is pretty far off, but just wanted to add it while I thought of it.
We'll probably need some repository of Enums, DLLs etc. in some JSON format. Or perhaps more ideally generated from the win32 metadata