Defold API Snippets for Visual Studio Code

Defold API Snippets for Visual Studio Code

Lua & C/C++ API Reference snippets for Defold Engine is available on Visual Studio Marketplace.

Github

vcs


Ordered Tabstops

Message Generation

Examples:

Type playsound and it will generate msg.post(receiver, "play_sound", {[delay], [gain]})

Type modelanimationdone and it will generate msg.post(receiver, "model_animation_done", {animation_id, playback})

Recommended Settings

Add Defold files.associations to your settings.json file.
Setting editor.snippetSuggestions to bottom change the order relative to suggestions.

"files.associations": {
        "*.script": "lua",
        "*.gui_script": "lua",
        "*.render_script": "lua",
        "*.editor_script": "lua"
      },
"editor.snippetSuggestions": "bottom"

Recommended Extension

Json Parser

There is a Python script which download and parse the latest version of the Defold API Reference available on Github repo.

35 Likes

I’m waiting for this one, thx dude! :grin: :heart_eyes:

3 Likes

Love initiatives as this, great job! :smiley:

2 Likes

Ohhhh I guess so much people have been waiting for this. Thanks!

2 Likes

Thank you for this great job!! :joy:

3 Likes

Just found this on the marketplace. Astounding job selimanac

5 Likes

Updated to API 1.2.163
Also, I’m using EmmyLua for some time now. Highly suggested!

6 Likes

EmmyLua is awesome. I also use it but in IntelliJ IDEA.:grinning:

3 Likes

Hi! I just want to thank you for this. I use VS Code for work every day, and I love it. Being able to use it for Defold is amazing. I am however missing one important feature… The ability to do proper debugging. Is there any way of connecting the Defold debugger to VS Code? Thanks!

3 Likes

We all missing this feature. As far as I know it is not possible. It maybe possible to trigger build/debug process by calling local Defold URLs but it is not documented and I couldn’t find a good solution with vscode.

2 Likes

We use modebug.lua (you’ll find it in builtins), but I’m sure there are others.
And if it’s anything like python, you can start the debugger server inside your program, probably with a localhost and a certain port, and then connect from it from the debugger.

A quick search found this for instance. I haven’t played with it, but it should surely be possible for you to find something that works.
https://marketplace.visualstudio.com/items?itemName=devCAT.lua-debug

4 Likes

Before Defold had debug tools the suggestion was to use ZeroBrane Studio for debugging so there must be a way.

1 Like

The Defold debugger uses the same functionality. It boostraps the game with the mobdebug init code so that you can launch with the debugger attached.

1 Like

I will take a look at that. Thank you.

Aha! Thank you for finding this. I’ll also take a look at it.

Hey, I’m trying to use your plugin + plugins you suggested, but when I print my module name I see all Defold’s functions in the suggestions and my module’s variables somewhere at the very bottom of a huge list.
Do you know how to fix it?

1 Like

Nope, no idea. If you find a solution please let me know. It maybe something that can be fixed by a few lines on settings file, but I don’t know, sorry.

Edit: @AGulev I found this:

"editor.snippetSuggestions": "bottom",

55

4 Likes

:heart_eyes:
Thank you!

1 Like