Codea Air CodeThis extension connects Visual Studio Code to the Codea iOS application. Your projects are kept in a folder on your computer, in sync with Codea, so you can edit them with Visual Studio Code and any other tool, then play, tweak and debug them on your device. Auto-completion and documentation features similar to Codea are available while working on the projects. Table of ContentsFeaturesProjects in Local FoldersEach project is kept in a regular folder on your computer, linked to the project in Codea. Because the files are local, everything works with them: Visual Studio Code's search, source control such as git, and other extensions and tools, including AI coding assistants. Changes are sent to Codea as soon as they are saved, and changes made on the device come back on their own, even while a project is running. A folder can hold many projects, the same way Codea organizes them, so a git repository of your Codea projects can be opened and linked as it is.
EditorThe editor knows Codea's API and your project: auto-completion, color pickers, font and sprite lists, snippets and documentation work much like in Codea. Auto-CompletionAuto-completion is available for the Codea API as well as symbols defined in the project and its dependencies. Symbols
ColorsMethods such as
Font and SpritesThe
SnippetsSnippets make it easier to format the different Lua control structures such as
DocumentationTypes can easily be documented using a triple-slash (
Go to DefinitionWith the Lua extension by sumneko installed, Codea Air Code sets it up for your linked projects, so Go to Definition (F12), Find All References and hover work on your code and Codea's API:
When the Lua extension is installed, Codea Air Code offers to set it up in a folder with linked projects; or run A global that may not exist, checked before it is used, is reported as undefined. Tell the Lua extension it is expected on that line:
SidebarThe Codea Sidebar gives access to the Projects, Assets, Reference and Parameters sections. ProjectsThe Projects section lists the collections and projects in Codea. Click the download button next to a project to get a copy in your folder, linked to Codea (see Linked Folders). Linked projects can be played from the list, or revealed in the Explorer. To get all your projects at once, click the download button at the top of the section, or the one next to a collection to get all of its projects. Codea's built-in collections, such as Examples, are left out of the first, but each of their projects can still be got on its own. The New Project button at the top of the section, or next to a collection, creates a project in Codea and gets it (see Creating, Renaming and Deleting Projects). A linked project lists its dependencies under it (see Dependencies), and projects in iCloud are marked with a cloud in the Explorer. The filter button at the top of the section shows only the linked projects and the collections holding them; click it again to show all projects.
AssetsThe Assets section lists Codea's asset packs: your Documents and iCloud Documents, your external folders, and the packs that come with Codea. Click a file to open it, or drag it into a Lua file to insert its asset key (see Assets). ReferenceThe Codea Reference section of the Sidebar contains the full documentation for Codea Legacy (3.x) and Modern (4.x) which can be navigated by clicking on the different chapters and functions. It is also possible to select and right click a word in a project's code to find the corresponding reference in the Legacy documentation (or using the
SearchThe files are on your computer, so Visual Studio Code's own search works as usual, across all your projects.
ParametersThe second section of the Codea Sidebar will show the current parameters for the running project, if any. All parameters can be controlled directly from Visual Studio Code even if the parameters are hidden in Codea, making it easier to tweak the projects.
Device PreviewClick the device button in the status bar, or run Showing the project, click or drag on it to touch it: the project's The first time the panel opens after Codea starts, iOS asks whether Codea may record its screen. Allowing it lets Codea send frames without slowing the project down; otherwise Codea draws each frame itself, which costs the project some of its frame rate. Frames are only asked for while the panel is visible, and not while files sync. DebuggerWith a project running, Visual Studio Code can be used to attach to the running project and then used for debugging. Values of variables and watches can be modified while the execution is paused.
Conditional BreakpointsTo set a condition on a breakpoint, right click a breakpoint and select
Enter a valid Lua expression which must be
Log PointsLog Messages can be set on breakpoints to print the message in the Debug Console instead of breaking the execution. This can also be used to print the result of expressions within curly braces as can be seen in the following example:
OutputThe running project's prints and errors appear in the InstallationSearch for "Codea Air Code" in Visual Studio Code's Marketplace and install the extension.
UsageGetting StartedThe
Linked FoldersA linked folder is a regular folder on your computer that the extension keeps in sync with a project in Codea. Playing, debugging, auto-completion and parameters work with Codea as they would on the device. Links are saved in the workspace's
Changes are kept in sync both ways:
Deletions are handled carefully, since Codea deletes files for good:
To stop syncing a folder, right-click it in the Explorer, or its project in the Projects section, and choose The Codea items in the status bar show the connection and play the project you are working on. Clicking the Codea item shows a menu to sync, reconnect or link a folder. Syncing can also be started with the button at the top of the Explorer.
While the project is running, the play button becomes a stop button.
ConnectionTo connect your folder to Codea, click
A device plugged in with a USB cable is listed first, by name, when Codea is open on it (see USB Connection). To find the device's IP to connect to if the device is not in the list, use the Air Code icon on the project selection screen in Codea. The default port is Clicking the Codea item in the status bar shows a menu to disconnect, reconnect, or connect to another device. While disconnected, changes stay where they are made, and are synced when the folder connects again. Fun Fact
USB ConnectionIf Wi-Fi is not accessible or is slow, you can connect to Codea over a USB cable. Plug the device in, open Codea, and choose it at the top of the list when connecting: devices on USB where Codea answers are listed first, by name. This goes through the service that Finder and Xcode use to reach a device, which is part of macOS; on Windows it comes with Apple's device support (the Apple Devices app or iTunes). You can also connect through iproxy, a utility part of libusbmuxd ( Multi-windowAir Code does not currently support multiple Codea windows or running projects. For this reason, when running a project from Air Code, all windows will be closed except one before running the project. Creating, Renaming and Deleting ProjectsTo create a project, click the New Project button (the Codea logo with a plus) at the top of the Explorer or of the Projects section, or right-click a folder in the Explorer and choose Renaming a linked project's folder in Visual Studio Code renames the project in Codea. The Deleting a project's folder never deletes the project in Codea. To delete a project in Codea, right-click its folder in the Explorer, or the project in the Projects section, and choose Files and FoldersFiles added, removed or renamed in a project's folder, from Visual Studio Code or any other tool, are added, removed or renamed in Codea as well. A renamed tab keeps its place among Codea's tabs. Folders inside a project are kept in sync too, with a version of Codea that keeps them. With an older one, a file moved into a folder is put back and left in Codea, and the output says so. DependenciesA linked project lists its dependencies under it in the Projects section, as Codea's editor lists them: the projects its code requires with When a dependency is linked too, the debugger opens its files in its own folder, and breakpoints set there stop in the projects that use it. AssetsAssets kept in a project, such as images, sounds and models, are part of its folder and are synced like any other file, so new assets can be added by copying them into the project's folder. To reference an asset in a project, drag-and-drop the asset from the Explorer view while holding the Shift key into a Lua file and the Asset Key will automatically be added. Assets in the Assets section of the Codea Sidebar drag into a Lua file the same way. Packs Codea lets you change, such as Documents, take new files with the add button next to them or by dropping files on them, and their assets can be renamed (F2, or Enter on Mac) and deleted (Delete, or ⌘⌫ on Mac). To work on a pack's files as ordinary files, click the link button next to it: the pack is kept in
CommandsAll commands included with this extension are prefixed with
RequirementsCodea 3.10. Folders inside projects, the dependencies of modern projects and the device preview need Codea 3.20. With versions of Codea that do not report changes made on the device, linked folders are checked for them every 10 seconds. LicenseChange LogSee the change log here |