[Deprecated] Guide how to turn VSCode into Defold IDE with debugger

Version 1.0.2.

  • Added the Deploy task with the [iOS / Android] selector.
  • Added the [Debug / Release] selector to the Bundle task.
  • Added *.project as ini file type to files associations.
  • Added open_bundle_folder boolean param to open the bundle folder after bundling is finished.
  • Separated texture_compression to texture_compression_debug and texture_compression_release params.
7 Likes

NOOB ALERT

Can someone please share a video or a more detailed version of doing this?
I couldn’t get it to work.

What i basically want to know is, how to use an external editor and not use VSCode or Atom as an IDE.

The error i get is :slight_smile:

clojure.lang.ExceptionInfo: handler ‘:open’ in context ‘:global’ failed at ‘:run’ with message ‘Cannot run program “/Applications/Atom.app” (in directory “/Users/jeeveshmakker/Defold Files/Tutorial/Walking astronaut tutorial”): error=13, Permission denied’
java.io.IOException: Cannot run program “/Applications/Atom.app” (in directory “/Users/jeeveshmakker/Defold Files/Tutorial/Walking astronaut tutorial”): error=13, Permission denied
java.io.IOException: error=13, Permission denied

Can someone help/guide?


This is what i receive

On Mac, you cannot run an .app directly (it’s a folder)
You have two options, either list the executable directly, or open the app using open.

Here’s an example with Sublime Text.

/Applications/Sublime\ Text.app/Contents/MacOS/sublime_text foo.txt

open -a /Applications/Sublime\ Text.app foo.txt

E.g in your case, perhaps this works (I don’t know Atom):

/Applications/Atom.app/Contents/MacOS/atom
1 Like

Looks like I missed the important starting point.
You can set VSCode as external editor on Mac by using the following settings:

Custom Editor: /Applications/Visual Studio Code.app/Contents/MacOS/Electron
Open File: {file}
Open File at Line: -g {file}:{line}

Screenshot 2021-11-13 at 14.16.29

Then I recommend that you first start VSCode yourself with the project folder and then open the files, otherwise Defold will try to run VSCode with the Defold icon in the Dock as a separate application.

3 Likes

:smiley: Gee… Thanks guys… I got it connected on Atom, with alll the features working…

Will give it a try on VSCode too… hopefully that works

Amazing work with the guide! Thanks!

4 Likes

Really appreciated the work !! Thanks ur effort and time !

i followed the instructions, and when i opened the script in vscode,
it seems doesn’t load up the project, i cant see the tasks, i have checked

-the defold editor path
-the external editor can open
-installed the extensions.

would you have any clue what could be my problem ?
Thanks !

1 Like

Hi!

There is no concept of loading a project other than to just open the project folder.

Can this scheme help you?

If not, can you explain in more detail what your problem is?

3 Likes

Yes, thats clears my confusion, i thought there was something like “load project”,
so i had already setup anything. Thanks for the illustration !! :grinning:

2 Likes

I think template is broken. Just running “Build and Run” without changing anything else pops up a dialog box that says “The preLaunchTask ‘Build’ terminated with exit code 1.” I haven’t been able to get break points working at all either.

All is fine as I see in my setup. Can you share the logs from the terminal tab?

What is your OS? Have you done all the setup steps with additional steps for Windows?

1 Like

I did follow those steps. I just got it working. It failed because Powershell was my default terminal shell, and it kept using that regardless of whether or not I had a Bash terminal selected. The following extra steps resolved my issue:

  1. Open Visual Studio Code
  2. Press CTRL + SHIFT + P to open the Command Palette
  3. Search for “Terminal: Select Default Profile” (previously “Terminal: Select Default Shell”)
  4. Select your preferred shell. In my case I selected “Git Bash”
2 Likes

Great! This is the instruction which is described at the link in additional step for Windows.

3 Likes

I am running on a Mac, and I get a similar error to some above.

cp: ./build/temp/_unpack/x86_64-darwin/bin/dmengine: No such file or directory

cp: ./build/x86_64-osx/dmengine: No such file or directory

chmod: ./build/temp/dmengine: No such file or directory

# Launching $ ./build/temp/dmengine ./build/default/game.projectc

.vscode/defold.sh: line 366: ./build/temp/dmengine: No such file or directory

I am able to build the application but not run it. I thought I followed all the same steps as above as well.

Thanks

1 Like

Sorry for the late reply, some circumstances.

Yes, Defold 1.3.7 changed the path of the dmengine file, so the error occurred.

I fixed it in 1.0.6, feel free to try.

4 Likes

@astrochili, Thank you for the guide! I created a VS Code extension pack with recommended extensions from your list, except the debugger since I don’t know how to use it. The pack installs 5 extensions with a single click.

And Defold annotations now also show table parameters and types for callback function parameters. In example, instead of ‘play_properties: table’ it will be ‘play_properties: { delay: number, gain: number, pan: number }’.

8 Likes

to me is the same thing build is empty and it gives that error

.vscode/defold.sh: line 330: .exe: command not found

cp: cannot stat ‘./build/temp/_unpack/x86_64-win32/bin/OpenAL32.dll’: No such file or directory

.vscode/defold.sh: line 341: .exe: command not found

cp: cannot stat ‘./build/temp/_unpack/x86_64-win32/bin/wrap_oal.dll’: No such file or directory

Launching $ ./build/x86_64-win32/dmengine ./build/default/game.projectc

.vscode/defold.sh: line 366: ./build/x86_64-win32/dmengine: No such file or directory

Hello! Your problem should be easy to solve. I see the YOUR-DEFOLD-PATH-HERE phrase in your logs. Please edit the .vscode/defold.sh and set the Defold path there according the instruction.

2 Likes

A bit of news.

In addition to the existing d954mas/defold-api-emmylua and mikatuo/defold-lua-annotations, I have published another annotation files generator for the Lua Language Server. But written in Lua, a language that is familiar to Defold users.

By design, it can be run on Windows, macOS and Linux. Only Lua or LuaJIT needs to be installed.

Quick Start

Install Lua and run the main.lua script.

$ lua main.lua

By default it generates the annotations for the latest version of Defold. But you can also specify the Defold version as an argument.

$ lua main.lua '1.5.0'

As a result, you will see the api folder with .lua files. These are the annotations.

Automatic Releases

Thanks to the action workflows, the repository automatically checks the latest version of Defold every day and releases the new version of annotations if required.

7 Likes