ESOUI lua API autocompletion for "JetBrains IntelliJ IDEA" IDE - using the "EmmyLua" plugin & esoui source code as SDK + search through
This is a description how to enable the ESOUI lua API autocompletion for the developer IDE "IntelliJ IDEA" by JetBrains, using the plugin "EmmyLua".
IntelliJ IDEA Community Edition is free to use: https://www.jetbrains.com/idea/download
I also provide the esoui API autocompletion files as ZIP archive here, which you need to download and extract somewhere on your harddrive to a folder that will not change, and can be used within IntelliJ IDEA settings as standard "external libraries" for your lua file related projects.
a) You need to install JetBrains IntelliJ IDEA (https://www.jetbrains.com/idea/) version 2019 or newer.
The type of the edition does not matter (community, education, ultimate, etc.).
Just follow the instructions of the website and the installer and install the software properly.
Start and configure it to your needs at the menu "File" -> "Settings" e.g.
b) You need to install the plugin "EmmyLUA" (https://plugins.jetbrains.com/plugin/9768-emmylua) inside the IntelliJ IDEA.
Check the compatibility of EmmyLua with the IntelliJ IDEA version here: https://plugins.jetbrains.com/plugin...mylua/versions
Some updates of IntelliJ IDEA will occur where EmmyLUA is not compatible, so do not update then until EmmyLUA is compatible again!
It will provide lua script support for variables, code checks and enable the auto completion file usage and variable declaration "jumpto" via CTRL+<left
mouse click> e.g. via own created lua files in your project structure and external libraries.
You can either use the IntellIj IDEA plugin manager or install it manually.
Here is an installation description, for both ways, by the plugin creators: https://emmylua.github.io/installation.html
This is how I did it:
b1: Start IntelliJ IDEA and open the menu "File"- > "Settings" -> "Plugins" -> Search for "EmmyLua" in the search input box at the top.
If you find more than 1 result: The author of the correct plugin is "tangzx".
b2: Click on the "Install" button at the line of the "EmmyLua" plugin. Follow the information shown in the popus and dialogs of the plugin manager.
b2 - alternative: You might also download the plugin via the plugin's website manually, using the "Get" button there.
Please refer to manual plugin installation within IntelliJ IDEA's documentation for plugins (https://www.jetbrains.com/help/idea/plugins-settings.html) and look for "Install Plugin from Disk".
b3: After the installation restart the IDE and invalidate the cache via menu "File" -> "Invalidates caches / restarts"!
b4: After the IntelliJ IDEA IDE was restarted open the settings once again via menu "File" -> "Settings" and navigate to the "Languages and Frameworks" category, where you choose the new shown entry "EmmyLua".
Change the lua version used to 5.1 as ESO only internally uses a ZOs changed lua 5.1!
Save the changes to the EmmyLua settings afterwards via the "Apply" button at the settings dialog.
HowTo enable the auto completion within IntelliJ IDEA IDE:
This list below shows the steps to take to enable the auto completion in the IntelliJ IDE.
If step description texts are related to other steps the "
<relating step number>)" tag will be shown in italic style inside the description text of the step ( e.g. 2) ) .
If step description texts are related to a number shown inside an image, the "image<Imagenumber>[<numberShownInThisImage>]" tag will be shown in italic style inside the description text of the step ( e.g. image1) )
- Download the ZIP archive for the needed ESOUI APIversion from this website here (see download link or "Other files" for older versions).
- Extract the ZIP archive to a folder which will not change, and where you are able to link to from within IntelliJ IDEA settings. In the further description here this folder where you have extracted the ZIP file contents to will be refered to as "ESOUI API autoCompletion files".
- Start IntelliJ.
- You need to close all open projects first via the menu "File" -> "Close project".
If any other IntelliJ IDEA window is opened close the projects there as well until you get the "Welcome to IntelliJ IDEA" project selection dialog shown.
Edit: IntelliJ IDEA removed the configure -> "Structure for new projects" from this popup!
You need to click on "New project" now, create an empty project.
Within the IntelliJ view of the new project click on the menu "File" ->"Project structure"
- The project structure dialog will be shown where you are able to configure the structure of new projects.
- Click on Platform settings -> SDK image1
Then click on the + image1 and choose "Add lua SDK".
A popup will ask you for the folder of the new lua SDK. Choose Any folder you want to have as the home directory of your SDK:
You will be able to change that at the "LUA SDK home path" line later on, clicking at the folder icon and choosing "Select lua SDK home from disk"
After that chose a name like "ESOUI lua live" (live e.g. for you live server lua SDK, and PTS e.g. for your PTS lua esoui src files as they could differ) as descriptionimage1
Click on the + image1 at the "Classpath" tab to add a folder where you have extracted the "ESOUI API autoCompletion files" at step 2).
The selected folder will show in the list at image1 afterwards.
- Save the project structure and you are able to open your lua AddOns with IntelliJ and use this project structure "ESOUI lua" on them.
- You need to use the new created "ESOUI lua" project structure for your lua projects then in order to make the auto completion work.
Your new projects contain a subfolder "External Libraries" where you are able to see the ESOUI API files and folders then:
- Existing projects will not automatically update their structure! You might either need to rebuild the projects by creating them new in the same folders and if the dialog asks you if exisitng project files should be overwritten accept it. Or you need to manually change the project structure files OF EACH project by opening it and selecting menu "File" -> "Project structure". Then choose/Add the SDK like described above for the project.
ESOUI source code browsing in Intelli & Defining 2 SDKs, 1 for ESO live and 1 for the PTS
You can download the most actual ESOUI source codes from GitHub once it was updated:
Click on the "master" branch selection dropdown and select the most actual PTS entry:
-> To download the whole folder as a zip file navigate to the "esoui/esoui" main folder and use the "Code" button at the right, click it to show a context menu and choose "Download ZIP":
Extract the zip file to any local folder and just differ between live and PTS sources so you can store 2 different source code packages!
e.g. extract the live ZIP file to c:\ESO_SRC\live and the PTS ZIP file to c:\ESO_SRC\PTS
Within IntelliJ IDEA:
I did define a lua SDK for the projects using the esoui src for live, and one for PTS. If you create a project set the appropriate module (choose the SDK in there) (live on live, PTS if you want to test PTS stuff) and then you can see them as "External files" at the bottom (just like my esoui auto completion) and are able to put the cursor on that external entry, press CTRL+SIFT+F to search in all files and you'll find the ZO_* whatever you search easily that way + are able to navigate through the sources via CTRL+left click to find declarations etc.
To do that define both, live and PTS (or the one needed for your purpose) as a SDK:
IntelliJ IDEA Menu -> File -> Project structure -> SDK (1). Click on the + (2) icon, add the entry (3) e.g. "Lua (ESO) live", click on the + (4) icon to add the patch and choose the patch for the extarcted live zip files:
Repeat the same if you want to have a PTS SDK as well!
Then as you have created a project (e.g. pChat) use the same menu file -> project structure and choose the entry "Module" (1) -> Select the SDK from the list (2):
Click "Apply" and you'll find it at the external entries of the project afterwards (it might take a bit as the index of the files will be rebuild the -> see statusbar of IntelliJ IDEA):
Click the folder e.g. esoui/app and press CTRL+SHIFT+F to search all files inside that folder.
It's easy to find some source codes that way + use CTRL+left click to navigate through the ZOs source code files.
Running lua code within IntelliJ IDEA IDE:
First of all: ESOUI source code is NOT running offline in your IntelliJ IDEA IDE! You MUST be logged in and try the addons and code ingame.
There is no way to test ESOUI related source code just in your IDE.
You can try your non ESOUI related scripts offline in a normal lua environment though (like testing if a standard string function works etc.) but you cannot use ANY of the Zos added functions like d() etc. You MUST use standard functions like print then.
If you want to run lua code within IntelliJ you can read here how to setup the configurations and templates:
You need a lua.exe of the desired lua version (ESO is using 5.1) installed somewhere.
Download lua 5.1 exe binaries here: https://sourceforge.net/projects/luabinaries/files/5.1.4/
In the IntelliJ IDEA menu "Run" -> "Edit configurations" you can configure how and where the lua.exe file is located that should be used to run your scripts.
You need to expand the category "Templates" and choose the entry "Lua Application".
At the right side you are able to change the program path of the lua.exe file and some other parameters like the working directory (OBLIGATORY, e..g use your project's folder).
After you have setup everything click at the top right on the link "Create configuration" and your template will be added to the list of "Lua Application" at the left side:
It will use this template config then for any Lua Application "Run" in the future.
Unfortunately it will NOT pass in the currently run filename's path and filename (e.g. "test.lua", see below) as parameter "Entry file".
So the lua.exe will just run but nothing is passed to it
I'd mark the checkbox "Show this dialog" in your saved Lua application template so you can enter the run directory (= your project dir) and the "Entry file" (= your .lua file) there then as you run it.
I've e.g. added a new lua file "test.lua" to my project and added a standard lua print("hey!") command to it:
The green triangle run button is available and if I press it the lua5.1.exe file will compile it.
After this it will be able to run your lua code via the selected lua.exe file:
Sirinsidiator created XSD files for the ESOUI XML files. Here is the link to siri's description:
In your XML files's head line you need to change this to make the XSD autocompletion work:
<GuiXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sir.insidi.at/or/schema/esoui.xsd">
Or for keybindings:
<Bindings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sir.insidi.at/or/schema/esobindings.xsd">
- Invalidate caches and restart: If anything is not working as intended try to use the menu "File" -> "Invalide caches / restart" to restart the IntelliJ IDEA IDE and clear the caches. This fixes most of the problems like not working auto completions etc.
All files can be found at github:
ESODocumentation_Pxx.txt parser script original by reaby
ESODocumentation_Pxx.txt parser script modified by Baertram
Releases for auto completion and variables (parsed results + manual added files) per ESO APIversion