# VS Code - Defold Buddy (extension with productivity tools)

**URL:** <https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508>\
**Category:** The Defoldmine\
**Created:** [January 26, 2023, 11:29pm UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508 "2023-01-26T23:29:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikatuo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mikatuo/32/20213_2.png) [@mikatuo](https://forum.defold.com/u/mikatuo)\
**Post date:** [January 26, 2023, 11:29pm UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/1 "2023-01-26T23:29:06Z")

</div>

## [Defold Buddy](https://marketplace.visualstudio.com/items?itemName=mikatuo.vscode-defold-ide)

Tools for Defold to make your life easier and coding experience nicer. The main focus of the Buddy is to automate repetitive boring tasks.

## Features

- IntelliSense for Defold API and project dependencies
- Autocompletion for Defold URLs of your project
- Asset Portal
- Open Defold Editor from VS Code
- Build (run) your game via Defold Editor from VS Code
- Fetch libraries via Defold Editor from VS Code
- Hot reloading for script and lua files on save
- Create a complex Game Object file from Explorer context menu
- Generate manifest (reduce game bundle size)

## IntelliSense for Defold API and project dependencies

![GitHub release](https://img.shields.io/github/v/release/mikatuo/defold-lua-annotations.svg?include_prereleases=&sort=semver&color=)

> **Demo (Defold API)...**
>
> 1. Open a Defold project
> 2. You should see a prompt to initialize the extension
> 
> or
> 
> 1. Press `Ctrl+Shift+P` (or `Cmd+Shift+P`) or go to `View` \> `Command Palette`.
> 2. Select `Defold Buddy: Initialize`
> 
> ![a138ae9600cd0fa1d520bb4fbb8f33c897f3aa8f](https://user-images.githubusercontent.com/7230306/222926907-57a8eae2-8db7-43d1-9d6c-80e651d83d3c.gif)
> 
> ![4cf75769ac699bbe2e1242fd9f6af705ccb29816](https://user-images.githubusercontent.com/7230306/222926911-23dd658c-359f-4739-8d04-e83add96aba0.png)

> **Demo (project dependencies)...**
>
> ![2647bce06606342c31c08006257d11e0173b23f5](https://user-images.githubusercontent.com/7230306/222926955-41f35bf5-bba3-4a96-8399-5edb8179e482.gif)

## Autocompletion for Defold URLs

> **Demo...**
>
> Note: read about the [addressing](https://defold.com/manuals/addressing/) if you are not familiar with the concept
> 
> ![fb28a66cc769e7ccf8135deb9bfc110bbbf2eb6a](https://user-images.githubusercontent.com/7230306/222926962-645fb3aa-7eaf-408d-8c7b-8464d76df6c2.gif)

> **Known issues**
>
> For now the suggestions are not refreshed automatically when you make any changes to your .go and .collection files. For now you need to re-index them manually by runnin a command.
> 
> 1. Open a `.script` file, you should see suggestions after typing a `"`, or pushing `Ctrl+Enter` with cursor next to a `"`.
> 2. Run “Defold Buddy: Index game files for autocompletion” when you need to refresh the autocompletion

## Asset Portal

> **Demo...**
>
> 1. Press `Ctrl+Shift+P` (or `Cmd+Shift+P`) or go to `View` \> `Command Palette`.
> 2. Select `Defold Buddy: Asset Portal`
> 
> ![ezgif-4-b091012f33](https://github.com/mikatuo/vscode-defold-buddy/assets/7230306/7ff1547f-d43c-4195-8066-5542c0509df8)

## Build (run) your game via Defold Editor from VSCode

> **Demo...**
>
> Note: requires Defold editor running in the background
> 
> Note: you can [set a hotkey](https://code.visualstudio.com/docs/getstarted/keybindings) for this command as well as for any other command
> 
> ![81887c48d3bad6b29c9dbb49bea0c179d652cb05](https://user-images.githubusercontent.com/7230306/222926974-5c4d7e5b-a29d-427b-a33e-abb29b09701c.gif)

## Hot reloading for script and lua files on save

After a `.script` or `.lua` file is saved it is automatically hot-reloaded if the game is running.

> **Demo...**
>
> Note: read about [hot reloading](https://defold.com/manuals/hot-reload/) in Defold
> 
> 1. Open Defold editor
> 2. Run your game via the editor
> 3. Modify a .script file and save it, the modified file should be hot-reloaded

## Create a complex Game Object file from Explorer context menu

Create a Game Object file (.go) with components (sprite, script) and a factory file (`.factory`) for that Game Object with less clicks

> **Demo...**
>
> ![147121c5ed7f8954862f3a27fee4cf8cf1efaa16](https://user-images.githubusercontent.com/7230306/222927012-4947ddb0-7b93-4bed-8e5e-4f96cb757d6f.gif)

## Generate manifest (reduce game bundle size)

> **Demo...**
>
> You can generate the app manifest from Defold editor:
> 
> ![fc6f5813cdea82f6a8f264f7634f3b28855e6a3f_2_408x429](https://user-images.githubusercontent.com/7230306/222927049-96c8af0b-880d-4021-9a63-7e9e031aeb16.png)
> 
> Or from VSCode:
> 
> ![8ea1248ec0f937778e9e3645a4158209fb53ada0](https://user-images.githubusercontent.com/7230306/222927056-03cd09eb-9fdb-4801-9286-a8d9c7d77aad.gif)

  

### Feedback [❤](https://www.buymeacoffee.com/mikatuo)

If you would like to collaborate, contribute or request a feature feel free to do it at [Github](https://github.com/mikatuo/vscode-defold-buddy)

#### Credit

Manifest generation code was copy pasted from [Defold App Manifest generator](https://github.com/britzl/manifestation) by [britzl](https://github.com/britzl).

#### Resources

Annotations used in this extensions are generated with [Defold Lua Annotations](https://github.com/mikatuo/defold-lua-annotations).

---

<div class="post-metadata">

**Author:** ![mikatuo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mikatuo/32/20213_2.png) [@mikatuo](https://forum.defold.com/u/mikatuo)\
**Post date:** [January 26, 2023, 11:35pm UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/2 "2023-01-26T23:35:52Z")

</div>

It would be great to add debugging. I read that mobdebug is used in the Editor and there is a VS Code extension for it. If anyone knows and can explain how to use it with Defold then it should be possible to add debug settings into one of the above extensions.

And it would be even better to start the project directly in Editor from VSCode (not via Bob because it didn’t work for me when I tried it in one of the existing extensions).

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [January 27, 2023, 6:27am UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/3 "2023-01-27T06:27:00Z")

</div>

> [@mikatuo](#):
>
> And it would be even better to start the project directly in Editor from VSCode (not via Bob because it didn’t work for me when I tried it in one of the existing extensions

This is something we will look into. I can’t say when though. We have a few performance related tasks that we are currently focusing on.

> [@mikatuo](#):
>
> If anyone knows and can explain how to use it with Defold then it should be possible to add debug settings into one of the above extensions.

I need to look up the details. I’ll share here later today.

---

<div class="post-metadata">

**Author:** ![Pawel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pawel/32/24623_2.png) [@Pawel](https://forum.defold.com/u/Pawel)\
**Post date:** [January 27, 2023, 8:32am UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/4 "2023-01-27T08:32:10Z")

</div>

Wow! Thank you @mikatuo ! ❤

Btw. Is there any request for something like this:

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/e/0/e09c383cc15b247dbcd49e29ce24ea106f35a0e9.png)

to implement e.g. in game.project settings? That would be a great feature! I know [Defold App Manifest generator](https://britzl.github.io/manifestation/), but if it would be a part of Editor it would be a blast!

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [January 27, 2023, 9:07am UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/5 "2023-01-27T09:07:59Z")

</div>

The long term plan is for us to have it configurable in the editor yes (with more features), but for now the online tool is doing the job well enough.

---

<div class="post-metadata">

**Author:** ![mikatuo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mikatuo/32/20213_2.png) [@mikatuo](https://forum.defold.com/u/mikatuo)\
**Post date:** [January 27, 2023, 9:24am UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/6 "2023-01-27T09:24:15Z")

</div>

Thank you! No rush. Once it’s ready I will add it into the extension.

Online manifest generator is great! Since it’s JavaScript it was super easy to add it.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [January 27, 2023, 9:26am UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/7 "2023-01-27T09:26:56Z")

</div>

> [@Pawel](#):
>
> to implement e.g. in game.project settings? That would be a great feature! I know [Defold App Manifest generator](https://britzl.github.io/manifestation/), but if it would be a part of Editor it would be a blast!

> [@Mathias\_Westerdahl](#):
>
> The long term plan is for us to have it configurable in the editor yes (with more features), but for now the online tool is doing the job well enough.

It is part of the editor now? @vlaaad added support for it a few months ago:

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/f/c/fc6f5813cdea82f6a8f264f7634f3b28855e6a3f.png)

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/1/1/11bf1623d36278156e436baf1c7111af419d6c65.png)

> **[App Manifest - Defold project settings](https://defold.com/manuals/project-settings/#app-manifest)**
>
> The file game.project contains all project wide settings. It must stay in the root folder of the project and must be named game.project. The first thing the engine does when starting up and launching your game is look for this file. | This manual...

---

<div class="post-metadata">

**Author:** ![Pawel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pawel/32/24623_2.png) [@Pawel](https://forum.defold.com/u/Pawel)\
**Post date:** [January 27, 2023, 9:40am UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/8 "2023-01-27T09:40:49Z")

</div>

> [@britzl](#):
>
> It is part of the editor now?

Yes, I totally missed it!

---

<div class="post-metadata">

**Author:** ![vlaaad](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/vlaaad/32/10538_2.png) [@vlaaad](https://forum.defold.com/u/vlaaad)\
**Post date:** [January 27, 2023, 9:59am UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/9 "2023-01-27T09:59:20Z")

</div>

Indeed, I ported manifestation web tool into the editor 🙂

---

<div class="post-metadata">

**Author:** ![gianmichele](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/gianmichele/32/24028_2.png) [@gianmichele](https://forum.defold.com/u/gianmichele)\
**Post date:** [January 27, 2023, 4:41pm UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/10 "2023-01-27T16:41:25Z")

</div>

That is fantastic!

---

<div class="post-metadata">

**Author:** ![mikatuo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mikatuo/32/20213_2.png) [@mikatuo](https://forum.defold.com/u/mikatuo)\
**Post date:** [February 2, 2023, 11:29pm UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/11 "2023-02-02T23:29:42Z")

</div>

Experimenting with more interesting stuff. Generating hashes for instances and components for all .collection files. It doesn’t include components for referenced instances yet.

> **Demo**
>
> ![Code_Ia8QKytgcE](https://defold-forum-bucket.nbg1.your-objectstorage.com/original/3X/0/8/08442c1ab17f436113fdf953eb806f82845fa7cd.gif)

---

<div class="post-metadata">

**Author:** ![mikatuo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mikatuo/32/20213_2.png) [@mikatuo](https://forum.defold.com/u/mikatuo)\
**Post date:** [February 5, 2023, 3:34pm UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/12 "2023-02-05T15:34:41Z")

</div>

v.0.6.2 - Added autocompletion for url-s inside .script files:

> **Demo**
>
> ![image](https://forum-defold-uploads.b-cdn.net/original/3X/c/c/cc1cab7100a021634e0f595b928ef43435d38d2a.png)
> 
> ![image](https://forum-defold-uploads.b-cdn.net/original/3X/0/b/0bba290aec60d4cea3a45d06f0a69f76bc2d29e4.jpeg)
> 
> ![java_6NpdZUvVLB](https://forum-defold-uploads.b-cdn.net/original/3X/f/b/fb28a66cc769e7ccf8135deb9bfc110bbbf2eb6a.gif)

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [February 6, 2023, 10:46am UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/13 "2023-02-06T10:46:59Z")

</div>

> [@britzl](#):
>
> I need to look up the details. I’ll share here later today.

The debugger is started by the editor when [`start.lua` script](https://github.com/defold/defold/blob/dev/editor/bundle-resources/_defold/debugger/start.lua) is loaded and run in the engine. The script is sent as a [RunScript protobuf message](https://github.com/defold/defold/blob/dev/engine/engine/proto/engine/engine_ddf.proto) to the running engine to the `/post` [endpoint on the engine service](https://github.com/defold/defold/blob/dev/engine/engine/proto/engine/engine_ddf.proto).

---

<div class="post-metadata">

**Author:** ![mikatuo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mikatuo/32/20213_2.png) [@mikatuo](https://forum.defold.com/u/mikatuo)\
**Post date:** [February 7, 2023, 11:31am UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/14 "2023-02-07T11:31:16Z")

</div>

Thank you! And this readme [DEBUG\_PORTS\_AND\_SERVICES.md](https://github.com/defold/defold/blob/dev/engine/docs/DEBUG_PORTS_AND_SERVICES.md) also helped a lot.

Can’t get it to work yet, but at least it doesn’t crash when I post a reload message. Will need to dig more into it.  
 ![image](https://defold-forum-bucket.nbg1.your-objectstorage.com/original/3X/8/c/8cf083124113f73d528ac8c906f92912af288dfe.png)

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [February 7, 2023, 4:21pm UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/15 "2023-02-07T16:21:51Z")

</div>

> [@mikatuo](#):
>
> Will need to dig more

Let us know if you get stuck!

---

<div class="post-metadata">

**Author:** ![mikatuo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mikatuo/32/20213_2.png) [@mikatuo](https://forum.defold.com/u/mikatuo)\
**Post date:** [February 12, 2023, 10:08am UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/16 "2023-02-12T10:08:46Z")

</div>

v 0.7.2 - Create `.go` + `.script` + `.factory` files from the Explorer’s context menu

> **Demo**
>
> ![java_2aUYxXAMxn](https://defold-forum-bucket.nbg1.your-objectstorage.com/original/3X/1/4/147121c5ed7f8954862f3a27fee4cf8cf1efaa16.gif)

---

<div class="post-metadata">

**Author:** ![mikatuo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mikatuo/32/20213_2.png) [@mikatuo](https://forum.defold.com/u/mikatuo)\
**Post date:** [February 23, 2023, 11:27pm UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/17 "2023-02-23T23:27:22Z")

</div>

Added intellisense for project dependencies.

> **Demo**
>
> ![Code_rgMqUf0RLa](https://defold-forum-bucket.nbg1.your-objectstorage.com/original/3X/2/6/2647bce06606342c31c08006257d11e0173b23f5.gif)

---

<div class="post-metadata">

**Author:** ![COCO](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/coco/32/38692_2.png) [@COCO](https://forum.defold.com/u/COCO)\
**Post date:** [February 24, 2023, 8:45am UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/18 "2023-02-24T08:45:04Z")

</div>

Great feature!  
I found in some extensions, when calling a function, “:” is used instead of “.” , like “room:send()”, but the intellisense always uses “.” :

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/0/2/02db7e0176c04ee36f21b9e6f45e9fb87308ce12.png)  
 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/4/b/4b34aacc116e9a3790c004a86556ba86903bcf34.png)

---

<div class="post-metadata">

**Author:** ![mikatuo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mikatuo/32/20213_2.png) [@mikatuo](https://forum.defold.com/u/mikatuo)\
**Post date:** [February 24, 2023, 9:48am UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/19 "2023-02-24T09:48:09Z")

</div>

Nice that you are using the plugin))  
I can have a look. What was the extension? It might be that EmmyLua annotations are required to correctly identify “:” vs “.”

---

<div class="post-metadata">

**Author:** ![COCO](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/coco/32/38692_2.png) [@COCO](https://forum.defold.com/u/COCO)\
**Post date:** [February 24, 2023, 11:40am UTC](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508/20 "2023-02-24T11:40:12Z")

</div>

The extension is [Colyseus-Defold](https://github.com/colyseus/colyseus-defold) and the annotations are written by myself. 😀

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/d/8/d8f210d36c562697b797879c2b9b0be71032b8b1.png)

[Next page](https://forum.defold.com/t/vs-code-defold-buddy-extension-with-productivity-tools/72508.md?page=2)
