VSCode extensions for Defold (aka Defold Extension Pack)

The LSP either does not recognize the room variable as Room type or the annotations are not picked up. Here is what I get when I type either “.” or “:” for a room:

Demo

image
and
image

Try adding:
image

Possible problem

Code_HM0yqatpLY

2 Likes

Yes, that solved the problem, thanks. It seems sumneko lua is not as good as emmylua on parsing nested annotations.

1 Like
Hot reloading when .script and .lua files are saved

8 Likes

Hi, I got a little problem:
When I run the command “Defold: Build”, the Defold editor cannot be found by the extension:
image

If I click the " Open Defold" button, a new Defold editor will be opened and the project will be loaded, but it still cannot be found by the extension.
I’m using a Defold Editor downloaded from Steam.
Thank you for any tips.

1 Like

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