Skip to main content

Lua and XML Autocompletion

This extension features autocompletion for both Lua and XML, here's how to use it.

Luaโ€‹

Lua autocompletion is built upon the same provider file that powers the official Atom Plugin, so it should be familiar to most users. The extension will try to guess the type of the variable, and will provide a list of functions and properties that are available for that type. This will also happen for function names and parameters, so you can get a list of parameters for a function by typing the function name and opening the autocomplete list. Ctrl+Space will also trigger the autocomplete list. Overview

Also note that the documentation for the function will be displayed in the tooltip, so you can get a quick reference of what the function does. Toggle between the documentation and the signature by pressing Ctrl+Space again.

The [More Info] link will redirect you to the official documentation for that function.

Updating the Autocomplete for Luaโ€‹

Coroutine Snippetsโ€‹

The extension also provides snippets for coroutines, so you can quickly create a coroutine and start it. The snippets are triggered after a function definition like so:

Coroutines

Require Snippetsโ€‹

The extension also provides snippets for require statements, so you can quickly require a file. The snippets are triggered when you start writing a require statement like so:

Require

getObjectFromGUID Snippetsโ€‹

There are 2 autocompletion items for getObjectFromGUID the first one takes a variable name as a parameter along with a suffix and the second will scan the current file for guids and suggest them as a completion items.

Suffixed getObjectFromGUID:โ€‹

The first one is triggered by typing getObjectFromGUID on the right side of an assignment like so:

GUID Suffix

Suffix is configurable in the extension settings

Scan getObjectFromGUID:โ€‹

Whereas the second one is triggered by triggering suggestions (Ctrl+Space) while inside the parenthesis of getObjectFromGUID

GUID Scan

This one works by executing a custom Lua function that requests all objects and returns the data through custom message, which is then picked up by the extension and subsequently offered as suggestions.

XMLโ€‹

XML Autocompletion is a lot simpler than Lua, the suggestions are loaded from a data array created by hand, so it's not as accurate as the Lua autocompletion, but it should be enough to get you started.

Tag autocompletion is available, so you can get a list of tags that are available at the current level. This is triggered by typing < and then pressing Ctrl+Space

XML1

Attribute autocompletion is also available, so you can get a list of attributes that are available for the current tag. This is triggered by pressing Space after a Tag or another Attribute

XML2