genius257 / vscode-autoit Goto Github PK
View Code? Open in Web Editor NEWAutoIt language extension for Visual Studio Code
Home Page: https://marketplace.visualstudio.com/items?itemName=genius257.autoit
License: MIT License
AutoIt language extension for Visual Studio Code
Home Page: https://marketplace.visualstudio.com/items?itemName=genius257.autoit
License: MIT License
Variable lookup within a function does not work as expected.
@genius257 Unfortunately, the latest update appears to have broken the GTD functionality for functions. ☹️
Originally posted by @Danp2 in #24 (comment)
Example:
#include <Array.au3>
$x = 123
Func x()
$x = 321
$MB_HELP
$x
EndFunc
The issue with the $MB_HELP
declaration is caused partially by the parser: genius257/autoit3-pegjs#33 (comment)
The remaining declaration resolve problem is caused by the Local/Global/Auto scope of a variable not being taken into account, within a function.
As matching variable declarations are found within the function (before the lookup origin), the scope of the declaration must be updated.
The Function alias Opt
was not directly in the official function list on the AutoIt3 docs. It is an alias for AutoItSetOption
Hi @genius257 ,
I was pleased to see that you use both "SemVer" and "keepachangelog" 👍 . To increase the benefit even more, I would suggest to use the CHANGELOG.md file with the GitHub TAG comparison functionality. I mean comparison of changes between the versions/tags.
See the possible changes in my fork branch extent-changelog-by-tag-comparison
here.
If you think this would be a easy but good improvement, please let me know. I would love to create the pull request 🤞 .
Best regards
Sven
currently /Inlcude/
is not appended to the end of the installDir config string, when trying to resolve Standard library files.
The resolve function taking the URI cannot handle backslash correctly and fails to resolve the correct file URI
Example:
#include "./json.au3"; Works
#include ".\json.au3"; Fails
DocBlock support for Files, Functions and Variables.
Info about how the structure of the Summary and Description are defined here.
The Summary and Description should be available in hover info and suggestion information.
Example for the DocBlock syntax in AutoIt3:
#cs
# A summary informing the user what the associated element does.
#
# A *description*, that can span multiple lines, to go _in-depth_ into
# the details of this element and to provide some background information
# or textual references.
#ce
When ripping the text from the helper page html source, links in the description text was not handled, and as such was omitted.
This results in incomplete description texts.
Macro help page reference: https://www.autoitscript.com/autoit3/docs/macros.htm
Example for incomplete description:
vscode-autoit/server/src/autoit/internal.ts
Line 168 in 7856c63
Text completion does not include keywords, like If
, Then
and Not
.
Running some basic tests, I've encountered one small issue with the GTD functionality. Here's a code sample --
#include "..\webdriver\wd_core.au3"
#include "..\webdriver\wd_capabilities.au3"
Func Main()
$_WD_Debug = $_WD_DEBUG_Full
_WD_CapabilitiesDefine($_WD_KEYS__STANDARD_PRIMITIVE, 'webSocketUrl')
_WD_CapabilitiesDefine($_WD_KEYS__STANDARD_PRIMITIVE, 'moz:debuggerAddress')
EndFunc
With the above, everything is good except that I am unable to find a reference for $_WD_Debug
, which is a global variable declared in wd_core.au3. Taking a deeper dive, it seems that most of the global variables from include files are not being recognized.
Add link to the "appendix" for the macro's: @KBLayout, @MUILang and @oslang
Currently the helper text does not include the link for the appendix.
the appendix link: https://www.autoitscript.com/autoit3/docs/appendix/OSLangCodes.htm
Currently it does not know what parameter you are on, but guesses based on when a comma is pressed.
It is tricky when the parser MIGHT detect a syntax error and not be able to calculate it based on AST tree information.
Another problem with the AST is there is no information about the position of the comma's between the parameters being entered, so currently it is tricky to know when moving with the arrow keys if the threshold between two parameters are crossed.
I will haft to look at how other extensions handle this, and see if a non janky solution is currently possible.
vscode-autoit/syntaxes/au3.tmLanguage.json
Line 230 in 54f5338
0x123; highlighted as hex
0X123; not highlighted as hex
Function Opt is not currently support for suggestions and hovering.
Expected cause is because it is omitted from the function listing on the official autoit3 documentation.
It is mentioned in "AutoItSetOption" but does not have it's own list entry.
The native AutoIt3 function Eval is basically a dynamic variable reference.
There are however less restrictions for variable naming, names like "@Magic"
are accepted.
Issue first discovered here: #24 (comment)
file type icon for au2 and au3 files would be nice.
This is to prevent the use of !
in front of array indexed values
vscode-autoit/server/src/main.ts
Lines 314 to 339 in 9289dd2
Generating the native suggestions should be done once, since it's not going to change
vscode-autoit/server/src/main.ts
Lines 361 to 367 in 9289dd2
Global $aItems = [1, 2, 3]
For $item In $aItems
ConsoleWrite($item & @CRLF)
Next
Currently $item
will not work for declaration lookup or completion suggestions.
currently no hover works within functions
#include <array.au3> ; this isn't working
#include "array.au3" ; this works fine, linking to "C:\Program Files (x86)\AutoIt3\Include\array.au3"
Settings.json file contains
"autoit3.userDefinedLibraries": [
"C:\\Users\\danpo\\Dropbox\\Autoit UDFs"
],
"autoit3.installDir": "C:\\Program Files (x86)\\AutoIt3\\"
Observations when using <>
as delimiters --
P.S. I wanted to investigate this myself, but all my breakpoints appeared as unbound. Can you provide guidance on this?
variables within the same line numbers, as a function in an included script, have their declarator seen as the parameter of said function.
Example that demonstrates this issue:
Func _ArrayAdd(ByRef $aArray, $vValue, $iStart = 0, $sDelim_Item = "|", $sDelim_Row = @CRLF, $iForce = $ARRAYFILL_FORCE_DEFAULT)
Is declared on line 77 in array.au3
#include <array.au3>
$aArray
A setting for hiding functions and variables prefixed with __
, normally used to indicate internal usage only.1
So if the Color UDF is included via #include <Color.au3>
functions like __ColorConvertHueToRGB
and variables like $__COLORCONSTANTS_HSLMAX
would not be suggested, but variables with the prefix within current open document would still be suggested.
Additionally a sub-setting for if the same applies to current open document might be needed. ↩
Currently Null
is not part of the list of keywords in the completion suggestions
Hover and goto declaration on x
breaks when an include statement exists.
Example to reproduce problem:
#include <Array.au3>
Func x()
;
EndFunc
x()
An error diagnostic should be sent to the client, when a non existing function is being referenced.
In vscode diagnostics are shown in the problems
tab.
vscode-autoit/server/src/main.ts
Line 37 in 1b03388
Currently hover does not work for the exit keyword
vscode-autoit/client/src/main.ts
Line 52 in 918b9b4
This generates a string that looks like file:///c%3A/Users/danpo/OneDrive/Documents/GitHub/vscode-autoit/server/dist/main.js
where the colon gets converted to %3A.
According to microsoft/vscode-extension-samples#564, toString(true)
should be used so that the string isn't encoded.
I noticed this message in the Output pane --
2023-04-02 11:47:05.073 [info] Extension 'genius257.autoit' uses a document selector without scheme. Learn more about this: https://go.microsoft.com/fwlink/?linkid=872305
After researching, it appears to be resolved by adding a scheme to this line --
vscode-autoit/client/src/main.ts
Line 21 in 918b9b4
Would adding scheme: 'file'
here break anything?
InetRead('https://www.autoitscript.com/autoit3/files/archive/autoit/')()
Wrong AST to string representation for array access in variable declaration information shown on hover.
Global $aVar = ["", $aRelativeURI[43], UBound($aRelativeURI)>44?$aRelativeURI[44]:"", UBound($aRelativeURI)>45?$aRelativeURI[45]:""]
$aVar
Shows as object property access via the dot notation:
$aVar = ["", $aRelativeURI.43, UBound($aRelativeURI)>44 ? $aRelativeURI.44 : "", UBound($aRelativeURI)>45 ? $aRelativeURI.45 : ""]
The native AutoIt3 function Assign is basically an extended variable declaration statement, and should be processed as such.
It will require some extra special logic due to:
$ASSIGN_CREATE
and $ASSIGN_EXISTFAIL
The flags parameter potentially being unavailable to resolve via static analysis may cause problems.
Issue first discovered here: #24 (comment)
Hover and goto declaration works, but the suggestions does not support this yet.
Currently code folding defined for au3 only specifies #Region
/#EndRegion
.
Code folding for things like Func
/EndFunc
and If
/Else
/EndIf
would be good.
relevant links to read up on topic:
https://code.visualstudio.com/api/language-extensions/language-configuration-guide#folding
DocumentLinkProvider for making file string on include statements into resolved file link.
P.S. I wanted to investigate this myself, but all my breakpoints appeared as unbound. Can you provide guidance on this?
Are you running the code using the "Client + Server"
option from the drop-down list in the debug tab?
Originally posted by @genius257 in #27 (comment)
Suggestions from includes will stop working seemingly randomly.
Could be something with the internal include cache.
Currently signature help is not available, caused by server logic expecting to have AST for the built-in function declarations.
The ideal solution, is an internal always loaded script instance that contains all the built-in functions.
This will currently make it impossible to show function description and documentation.
Therefore this feature will wait for #41 to finish first, so that existing function documentation shown can be transferred to the function Docblock.
Based on fix for issue #22
Low priority.
DocumentSymbolProvider for global overview of document symbols
Output:
[Error - 2:53:48 PM] Request textDocument/documentLink failed.
Message: Request textDocument/documentLink failed with message: process is not defined
Code: -32603
It looks like there is an issue with constant arrays.
Only the first occurrence of an constant array is marked as problem.
Const $constVar = 2
Const $constArray[2] = [1, 2]
Const $constArray2[2] = [1, 2]
Problem:
Expected " ", "=", "\t", or [0-9a-zA-Z_] but "[" found.
[{
"resource": "/C:/Users/GlobalConstArray.au3",
"owner": "generated_diagnostic_collection_name#0",
"severity": 8,
"message": "Expected " ", "=", "\t", or [0-9a-zA-Z_] but "[" found.",
"startLineNumber": 2,
"startColumn": 18,
"endLineNumber": 2,
"endColumn": 19
}]
The native AutoIt3 function Execute allows executing a string as a normal AutoIt3 statement.
However it does have some special limitations, like variable declaration and assignment not persisting outside the function call.
Issue first discovered here: #24 (comment)
The native AutoIt3 function IsDeclared is basically a dynamic variable reference.
There are however less restrictions for variable naming, names like "@Magic"
are accepted.
Issue first discovered here: #24 (comment)
Easy implementation is to simply add this feature for the standard files in the AutoIt include directory, to avoid too much IO.
Alternative is to once scan and map all files in Standard library, User-defined libraries and workspace.
Watching the folders for changes if possible would be a plus.
See https://stackoverflow.com/a/53015835/3958400 for inspiration on how to trigger.
Known PreProcs sould be in the completion suggestions
Examples: #include-once
, #include
, #pragma
, #comments-start
, #comments-end
, #cs
, #ce
and #NoTrayIcon
.
Special PreProcs for Au3Check should also be added: #ignorefunc
, #forceref
and #forcedef
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.