Defold KitA toolkit for Visual Studio Code to develop, build, launch, debug, bundle and deploy a game with Defold.
You can not to use the Defold Editor at all if you are only working with code at the moment. SetupIt's possible to install the extension from Visual Studio Marketplace or manually by downloading the After installing the extension and opening a Defold project, you will be prompted to setup Defold Kit with a step-by-step dialogue. If for some reason this doesn't happen, you can run the Setup command manually. Path to DefoldDefold Kit requires Defold installed (surprise). Select the automatically suggested path if it exists, or select the Defold folder manually. ExtensionsSelect the extensions you want to install. The first two are highly recommended, the next three are optional:
WorkspaceSome additional settings to apply to the workspace. Debugger Scripts
To debug the game with breakpoints, it's required to start the debugger on the game side. These files allow you to do that. Launch Configuration
To launch the game from the Run and Debug panel, it's required to add the relevant configuration to the Workspace SettingsThese settings are recommended for Defold project workspace to make your development more comfortable. The settings will only be applied to the installed extensions. You can check them in the settings.ts. Workspace RecommendationsAdds Defold Kit to the Annotations Syncing
Synchronise Lua annotations with the Defold Editor version and project dependencies. Defold API AnnotationsFethes Defold API annotations from the repository according the settings and unpacks them to the Defold Kit shared storage. Dependencies AnnotationsUnpacks archives from the Opening Files from DefoldTo open script files from the Defold Editor directly in Visual Studio Code, you must set the following settings by specifying the path to the executable file:
Set these parameters to open specific files and lines:
The Run and DebugLaunchTo launch a game ensure that two these steps are done during setting up Defold Kit:
Ensure that the BreakpointsTo make the breakpoints work ensure that Debugger scripts are added to the workspace. Then add the
CommandsCommands with the SetupStarts the setup dialogue. It's okay to run this command many times if you are not sure you are ready to turn on all the features at once. Sync API AnnotationsOpens the Annotations Syncing dialogue. Clean API AnnotationsDeletes all the previously synced annotations from the global storage and workspace storage. Open DefoldOpens the current project in the Defold Editor. On macOS, the window will be switched if Defold is already running. Clean BuildRuns a bob instance with the Resolve DependenciesRuns a bob instance with the BundleRuns a bob instance with the Executes for all selected target platforms one by one. When finished will prompt you to open the bundle folder. PlatformsSelect which target platforms you want to bundle your game. Options
Deploy to MobileDeploy to the connected mobile device with ios-deploy for iOS and adb for Android. These tools must be installed and accessible via shell.
The TasksBuild tasks with the Tasks are aliases of some commands described above to have a quick access to them. SettingsdefoldKit.general.editorPathThe path to the Defold Editor folder. Running the Setup command is the preferred way to update this value, but you can edit it manually if you're sure of what you are doing. defoldKit.general.suggestSetupSuggest to setup Defold Kit if the defoldKit.general.showBobOutputOpen the Output panel during a bob instance executing. defoldKit.annotations.repositoryWhere to get Defold API annotations. Three options are currently available: defoldKit.annotations.autosync.defoldAutomatically synchronize annotations for Defold API with the Defold editor version when needed at extension startup. defoldKit.annotations.autosync.libsAutomatically synchronize annotations for dependencies when changes are detected in the defoldKit.dependencies.emailUser email to resolve dependencies. Adds the defoldKit.dependencies.authTokenAuthentication token to resolve dependencies. Adds the defoldKit.bundle.ios.debug.provisioningProfilePath to the Adds the defoldKit.bundle.ios.debug.identityCode signing identity for the Debug variant on iOS. Adds the defoldKit.bundle.ios.release.provisioningProfilePath to the Adds the defoldKit.bundle.ios.release.identityCode signing identity for the Release variant on iOS. Adds the defoldKit.bundle.android.keystorePath to the Adds the defoldKit.bundle.android.keystorePassPath to the Adds the defoldKit.bundle.android.keystoreAliasName of the alias from the keystore for Android. Adds the CompatibilityIt's possible to uncheck all the options during Defold Kit setup and still be able to sync annotations, bundle and deploy the game. To use your own annotations solution you can skip the Annotations Syncing step or run the Clean API Annotations command. Due to the flexibility of Defold Kit, it can be used in combination with the Defold Buddy extension, which adds additional sugars and features. Logs
Troubleshooting
Make sure that these extensions are activated. Defold Kit cannot distinguish a deactivated extension from a missing extension due to the lack of the corresponding Visual Studio Code API.
Make sure that you started the debugger on the game side.
This can happen if you call a method on the requested module in a single line. Watch defold/defold/7963 for updates.
LimitationsChange breakpoints at runtimeBreakpoints can be set before launch and changed on pauses only. But there is a workaround, you can bind some input key to call Watch tomblind/local-lua-debugger-vscode/#32 and local-lua-debugger-vscode/pull/67 for updates. Debug on mobile devicesLocal Lua Debugger is a local debugger. So you can't debug the game on the device by this way. |