Thread Tools Display Modes
Today, 03:37 AM   #1
SirNightstorm
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
Today, 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,143
Nope, that's correct.
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.
  Reply With Quote

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


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