Thread Tools Display Modes
08/21/24, 03:37 AM   #1
SirNightstorm
AddOn Author - Click to view addons
Join Date: Oct 2017
Posts: 1
Autocompletion files ---@return parameters

Hi Baertram, all,

Not sure if I'm being dumb, but...

The immensely useful JetBrains IntelliJ IDEA autocompletion files have return annotations like this one:

Code:
--- @return gameTimeInSeconds number
function GetGameTimeSeconds() end
...whereas the EmmyLua docs (and the linting that I'm seeing in VSCode) expects:

Code:
---@return MY_TYPE[|OTHER_TYPE] [@comment]
The upshot being that this code:

Code:
local t = 0
GetFrameTimeSeconds()
gives an IDE warning:

Code:
This variable is defined as type `number`. Cannot convert its type to `gameTimeInSeconds`.
- `gameTimeInSeconds` cannot match `number`
- Type `gameTimeInSeconds` cannot match `number`Lua Diagnostics.(cast-local-type)
Just wanted to know if I'm missing something obvious?

Thanks,
David
  Reply With Quote
08/21/24, 03:58 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,190
Nope, that's correct.
The lines like --- @return gameTimeInSeconds number come from the API documentation files and were not compatible with all IDE plugins etc.
EmmyLua and IntelliJ somehow have some issues there and vscode also expectsthe format to be different.

DakJaniels already worked on that topic (many thanks!) and the user MycroftJr added even more to it (also my thanks!) to add aliases so gameTimeInSeconds will have an alias to number, and other types get fixes too.
That should work with vscode and IntelliJ IDEA in the end.

We also worked on an update of the API parsing php tools to add that documentation and luadocs code properly and autoamtically for the future.
I just had not found the time to test and update it properly yet, but it's on the list.


Here is the current beta version if you want to try it out:
https://github.com/Baertram/IntelliJ...am%26MycroftJr

You can dl it and dl the most up2date ESOUIDocumentation.txt file from ESOUI sources (live e.g.) and then run the batch files
1_, 2_, 3_, 4_ to create the "release".

That release files can then be taken for vscode and IntelliJ IDEA for autocompletion.
The generated files should be in the folder _release in the end

-> The current _release files should be the files for the last live API version (h1. ESO UI Documentation for API Version 101042) so you can just copy the files and test if that works for you already (without generating new ones). It's just not current Update 43 data then.

Last edited by Baertram : 08/22/24 at 03:12 AM.
  Reply With Quote
08/22/24, 03:11 AM   #3
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,190
I've run the scripts on ZOsDanBatson's new APIdocumentation file which he provided yesterday and released an update:
https://www.esoui.com/downloads/info...cessearch.html

Let me know please if the aliases properly work for you now in your IDE.
  Reply With Quote

ESOUI » Developer Discussions » Dev Tools » Autocompletion files ---@return parameters

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off