EmmyLua / VSCode-EmmyLua

Lua IDE/Debugger Plugin for VSCode
638 stars 94 forks source link

Remote debugging? #180

Open iandol opened 1 day ago

iandol commented 1 day ago

@CppCXY recommended I open a new issue from https://github.com/LuaLS/lua-language-server/issues/2951

In Zerobrane Studio Mobdebug works really well and is easy to setup (luarocks install mobdebug and turn remote server on in GUI, add these to script md=require("mobdebug") and then md.start()). I've previously used VSCode-Mobdebug, but it is not actively developed and is not stable. I've tried LuaHelper with LuaPanda but prefer to LuaLS.

How can I setup remote debugging. I added the EmmyLua debug configurations, and also require("emmy_core") in my target lua script. But running "emmylua new Debug" I get this error:

image

The other debug config "Attach by Program" does not seem to support remote debugging?

My require("emmy_core") also fails, what is the procedure to install it?

macOS M2, latest VS Code, lua 5.4.7 and luarocks installed using homebrew

CppCXY commented 1 day ago

press: command + shift + p and search emmy: image this will insert some code like:

package.cpath = package.cpath .. ";c:/User/Path/to/emmy_core/?.dll"
local dbg = require("emmy_core")
dbg.tcpListen("localhost", 9966)

you can add more code for debug:

dbg.waitIDE()
dbg.breakHere()

You need to run the Lua script first and then run the debug configuration, or use a task to start the corresponding Lua program.

iandol commented 1 day ago

OK, that is working thanks! Will you accept a pull request with these instructions in case future users would like to get set up?

CppCXY commented 1 day ago

OK, that is working thanks! Will you accept a pull request with these instructions in case future users would like to get set up?

Of course, if you are willing.