# Has anyone tried to create a mobdebug extension for VSCode?

**URL:** <https://forum.defold.com/t/has-anyone-tried-to-create-a-mobdebug-extension-for-vscode/67824>\
**Category:** The Defoldmine\
**Created:** [March 16, 2021, 9:15am UTC](https://forum.defold.com/t/has-anyone-tried-to-create-a-mobdebug-extension-for-vscode/67824 "2021-03-16T09:15:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![astrochili](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/astrochili/32/37266_2.png) [@astrochili](https://forum.defold.com/u/astrochili)\
**Post date:** [March 16, 2021, 9:15am UTC](https://forum.defold.com/t/has-anyone-tried-to-create-a-mobdebug-extension-for-vscode/67824/1 "2021-03-16T09:15:26Z")

</div>

As we know Defold uses the [mobdebug](https://github.com/pkulchenko/MobDebug), a remote debugger created and used by [ZeroBraine Studio](https://studio.zerobrane.com/) author.

This is easy to start mobdebug server separately and connect Defold game to it by using built-in **mobdebug.lua** script. Just download [mobdebug](https://github.com/pkulchenko/MobDebug/blob/master/src/mobdebug.lua), install [luasocket](https://luarocks.org/modules/luasocket/luasocket) and run the server via terminal:

```lua
$ lua -e "require('mobdebug').listen()"

```

Then run the game from Defold Editor with this script:

```lua
local mobdebug = require 'builtins.scripts.mobdebug'

function init(self)
  mobdebug.start()
end

```

And you will see that debugger works fine, all commands like to set breakpoint or to see the stack are available via command line with stdin/stdout.

Has anyone tried to create a mobdebug extension for VSCode? Its [debugging architecture](https://code.visualstudio.com/api/extension-guides/debugger-extension) with [debugger adapter protocol](https://microsoft.github.io/debug-adapter-protocol/) looks very friendly and ready to use with any debugger. The only thing left to do is to make an adapter-extension between mobdebug server and the VSCode debugging UI.

Of course, mobdebug can be used to create a debugger for any other text editor, such as Atom. But in fact Atom does’t have any official and universal debugging UI, so VSCode is more attractive here.

---

<div class="post-metadata">

**Author:** ![dapetcu21](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dapetcu21/32/25120_2.png) [@dapetcu21](https://forum.defold.com/u/dapetcu21)\
**Post date:** [March 16, 2021, 10:35am UTC](https://forum.defold.com/t/has-anyone-tried-to-create-a-mobdebug-extension-for-vscode/67824/2 "2021-03-16T10:35:51Z")

</div>

I think it’s even possible to start the mobdebug instance the same way the editor starts it. (By making a HTTP request to the engine’s debug port)

---

<div class="post-metadata">

**Author:** ![selimanac](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/selimanac/32/6397_2.png) [@selimanac](https://forum.defold.com/u/selimanac)\
**Post date:** [March 16, 2021, 11:07am UTC](https://forum.defold.com/t/has-anyone-tried-to-create-a-mobdebug-extension-for-vscode/67824/3 "2021-03-16T11:07:57Z")

</div>

This could be a good starting point as @Mathias_Westerdahl suggested:

> [@Defold API Snippets for Visual Studio Code](https://forum.defold.com/t/defold-api-snippets-for-visual-studio-code/30321/11):
>
> 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](https://marketplace.visualstudio.com/items?itemName=devCAT.lua-debug)

Source:  
[https://github.com/devcat-studio/VSCodeLuaDebug](https://github.com/devcat-studio/VSCodeLuaDebug)

Other one:  
[https://github.com/BeamNG/VSCodeLuaDebug](https://github.com/BeamNG/VSCodeLuaDebug)

---

<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 22, 2023, 11:37pm UTC](https://forum.defold.com/t/has-anyone-tried-to-create-a-mobdebug-extension-for-vscode/67824/4 "2023-01-22T23:37:22Z")

</div>

One more  
[https://github.com/moteus/vscode-mobdebug](https://github.com/moteus/vscode-mobdebug)
