VS Code - Defold Buddy (extension with productivity tools)

I see. Looks like the extension can’t find the editor log files. They must be stored elsewhere by Steam.

Downloaded the extension today, also having a problem with Defold Project → Build, the extension says it can’t find the running editor. 1.4.3, macOS.

1 Like
  1. Install https://github.com/moteus/vscode-mobdebug
  2. Add this code to any bootstrap script:
  local mobdebug = require 'builtins.scripts.mobdebug'
  mobdebug.start()
  1. Add this configuration to .vscode/launch.json:
        {
            "name": "Lua MobDebug: Listen",
            "type": "luaMobDebug",
            "request": "attach",
            "workingDirectory": "${workspaceFolder}",
            "sourceBasePath": "${workspaceFolder}",
            "listenPublicly": true,
            "listenPort": 8172,
            "stopOnEntry": false,
            "sourceEncoding": "UTF-8"
        },
  1. Run the listener in VSCode.
  2. Run the game, it will connect to the debugger.

Tested it with my shell script for building and running as the pre-task, works +/- fine.

3 Likes

Oh yes, this item isn’t required if you run the build in the Defold editor, as far as I understand it that way. Because Defold Editor already do it as a hook.

I could not test sooner, but I tested today on a MacBook and it works fine with tutorial projects. The Defold is installed from the website, not from Steam.

Generated Lua annotations for v1.4.7. If you find any issues please let me know.

image

4 Likes

In extension v0.9.8 as a backup option you can enter editor’s port manually. You only input it once while the editor is running. If the editor restarts or closed and then re-opened it will get a new port and you will have to input it again.

“Project > Build” can now open Defold on MacOs if it’s not running. Note: it has to be installed in Applications with name Defold.

3 Likes

Hi. I am new to Defold. I am using VS Code and is able to connect Defold to use VS Code by following the guide. However I don’t know why I am not able to open scripts from dependent libraries. It opens VS Code, but the script I clicked is not loaded to VS Code. It is also not available in the project folder to be opened manually. Does anyone know how to configure this?
Thank you!

Try this guide — Editor preferences, it explains how to configure Defold to open scripts in VSCode.

Sorry, it’s not possible to open extension scripts in VS Code at the moment. The only way to do it is to copy this script from the extension to the project in the Editor and then open it

I see. Thank you!

Hello! First of all, thank you for this incredible plugin! I like vs code and really appreciate to the possibility of using it with Defold. My question about how I can open files from different libraries or builtins folder.
I understand that they are read-only but I want to at least see them in explorer panel and copy something from them
Thank you!

2 Likes

Does this work with (or replaces?) Defold Kit? Looks cool!

1 Like

Hello! Check for assets in the .defold/assets folder in your project (they are automatically unzipped by the extension from the .internal/libs folder. The builtins folder won’t be there as it’s stored by Defold editor in a different place (depends on OS).

1 Like

In theory they should work nicely together. There is some overlapping functionality, the code intellisense is provided by both.

1 Like

I use both (with great satisfaction :slight_smile: ) and I have never experienced any issue

2 Likes

I’m sorry but I don’t quite understand :slight_smile: I made a gif where I show how it looks in my project. I found files but they are not supported by vscode

You seem to not have ran the “Defold Buddy: Initialize” command because there is no .defold folder in your project which is added by the extension. I’m pretty sure assets are not unzipped without initialization.

image

3 Likes

Yes! thank you! Now it is working

To anyone interested there is now project initializer for Teal that does these steps from extension-teal for you and adds code completion for Defold API using Defold Teal Annotations.

9 Likes