EmmyLua / IntelliJ-EmmyLua

Lua IDE/Debugger Plugin for IntelliJ IDEA
https://emmylua.github.io
Apache License 2.0
1.72k stars 287 forks source link

Windows: Emmy-Lua Debugger(NEW) breakpoints are not hit but dbg.breakHere() works as expected in Unity tolua project #515

Closed david-grem-armstrong closed 1 year ago

david-grem-armstrong commented 1 year ago

Environment(环境)

name version
IDEA version RD-222.4459.9,
EmmyLua version 1.3.7.2-IDEA222
OS Windows 11

What are the steps to reproduce this issue?(重现步骤?)

  1. create Emmy-Lua Debugger(NEW) configuration in Rider
  2. add appropriate lua snippet to use "emmy_core" to attach debugger
  3. using dbg.waitIDE() and dbg.breakHere() to validate that the IDE can connect

What happens?(出现什么问题?)

dbg.breakHere() functions as expected, but "Step", "Step Into" and trying to "Resume" to another breakpoint doesn't work.

What were you expecting to happen?(期望?)

Breakpoints and "Step" and "Step Into" should functions as expected

Any logs, error output, etc?(有没有什么log, error输出?)

None

Any other comments?(其它说明)

CppCXY commented 1 year ago

breakpoint debugging is based on chunkname(it is parameter passed on to lua.Dostring ), if you want the breakpoint to work as expected, you need to make sure that the chunkname is in the correct case and matches the file path, for example:

if chunkname is 'C:/user/desktop/unity project/Assets/Bundle/Lua/Main.lua', it can hit the breakpoint accurately. or 'Lua/Main.lua' also works correctly.

so all you need to do is change the chunkname so that it conforms to the file path(absolute or relative).

CppCXY commented 1 year ago

another case is that if your rider's version is more than 2021.1, it requires you add lua to unity>Edit/Project Settings/Editor/C# project generation and regenerate the sln file and restart Unity. this way Rider will collect the Lua files correctly

CppCXY commented 1 year ago

if you have msbuild you can try https://github.com/CppCXY/EmmyLua-Unity2/actions/runs/3613466359 for get unity api. It is very likely that it does not work correctly on the Mac

david-grem-armstrong commented 1 year ago

It looks like Regenerating the project .sln after adding .lua to the Project Settings file list was the key. Thanks.