Go to Page... |
|
Thread Tools | Display Modes |
|
12/19/23, 04:24 PM | #1 | |
Join Date: Dec 2022
Posts: 24
|
How to get VSCode to recognise XML objects in LUA files?
I'm using VSCode, with some LUA plugins, to write a ESOUI addon, and I've managed to configure the sumneko.lua VSCode extension to recognise ESOUI global functions and constants (e.g. events). It still flags any objects defined in the addon's XML files as unknown, though. Is there any way to configure VSCode to find these definitions?
VSCode also flags the constant (?) "GuiRoot" as unknown in the addon code line Code:
FooAddonIndicator:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, left, top) I have both the addon framework and the api-lua-intellij autocomplete directories in the workspace.libraries search list for the VSCode sumneko.lua extension, but it still won't find "GuiRoot" for some reason. My apologies if this information is already available somewhere on this forum. I've been reading Baertram's guides, the ESOUI API pages, and also guides on LUA, so I have done my best to teach myself. |
|
12/19/23, 04:27 PM | #2 |
Moved to dev tools forum.
I'm not sure how VScode can do that, i'm using IntelliJ IDEA and if you include teh esoui source code (you can download it here at esoui like an addon: https://www.esoui.com/downloads/info...ourcecode.html). Extract the zip file -> esoui folder with all folders and files somewhere -> Not in live/Addons!!! I'd e.g. put it somewhere totally different so it get's not loaded "as an addon". In IntelliJ IDEA you need to define that folder then in the project config as an "SDK" e.g. "SDK - ESO live". And if you include that SDK to the project it will find globals like GuiRoot and others and you can search and naviggate them via CTRL+left click etc. Not sure how VScode does that but must be similar. btw: XML created controls can be created via lua code too so there is no "only XML" or "only lua". The only thing that's different is that the XML attributes and tags and the code to craete them there looks different. Here is a XML valdator scheme for ESOUI, by sirinsidiator. If you include that into your XML files top line you can auto complete some XML attributes and tags via SHIFT+SPACE or whatever VSCode supports for auto completion there. Overwrite <GuiXml> with this: Code:
<GuiXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sir.insidi.at/or/schema/esoui.xsd"> GuiRoot is never defined in any esoui lua files I just saw, there is no "GuiRoot =" or similar. So that's why VScode and IntelliJ IDEA might not know such globals. Guess you would have to define them yourself in the auto completion files if you really need them. There is only GuiRoot for all controls of the UI and GuiMouse for the mouse cursor area. Last edited by Baertram : 12/19/23 at 04:37 PM. |
|
12/19/23, 05:37 PM | #3 |
Yeah, like Baertram mentioned you need your own autocomplete files in addition to the ESO-Api ones.
You can add multiple ones. That's what one of my workspace configs looks like: JSON Code:
Most of the GUI elements are just Control. As long as you have a definition for Control somewhere, you can type hint global elements as Control in the autocomplete file and custom variables directly, if you want. Something like: Lua Code:
And this is what I have as Definition of control and GuiRoot in some file: Lua Code:
With the autocomplete hints you can get rid of all false positive errors and concentrate on the real error messages. Generation Script If you don't want to do it manually and have Python you can try my project specific generator. Should work with most other ESO-GUI XML files. https://github.com/manavortex/Furnit...generateGui.py And that's the result: https://github.com/manavortex/Furnit...ns.lua#L22-L99 |
|
ESOUI » Developer Discussions » Dev Tools » How to get VSCode to recognise XML objects in LUA files? |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Hybrid Mode |
Switch to Threaded Mode |
|
|