actboy168 / lua-debug

Lua Debug Adapter for Visual Studio Code
MIT License
437 stars 95 forks source link

Launching debugger hits breakpoints as normal, but shows no visual indication #102

Closed bleachkitty closed 3 years ago

bleachkitty commented 4 years ago

Whenever I hit a breakpoint, I get no visual indication of hitting that breakpoint except that it places my cursor on the appropriate line. The callstack, variables, and everything else works as intended, but there's no indication in the code itself (no yellow highlight or anything).

This is a screenshot of me at a breakpoint:

no_indication

Here is my configuration:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Journey x86 Debug",
            "type": "lua",
            "request": "launch",
            "stopOnEntry": false,
            "stopOnThreadEntry": false,
            "runtimeExecutable": "${workspaceFolder}/bin/x86/JourneyD.exe",
            "cwd": "${workspaceFolder}/bin/x86",
            "consoleCoding": "utf8",
            "luaVersion": "5.3",
            "luaArch": "x86",
        }
    ]
}
actboy168 commented 4 years ago

It may be because your chunkname does not meet the Lua standard.

bleachkitty commented 4 years ago

Thank you for getting back to me.

As far as I can tell, my chunkname is correct. On the C++ side, I'm using luaL_loadfile() and the path should be fine. Here's an example of the parameter being passed to it:

image

Note that this worked several months ago when I last was working on the Lua side of this project, so something either changed with VS Code or with this plugin. I did revert this plugin back several versions and it didn't work, so I'm guessing it's something that changed in VS Code. I also found this: https://github.com/microsoft/vscode/issues/68616

That post is about Node.js, but it's pretty much the same issue I'm experiencing. This implies something changed in their debug API.

Any ideas?

actboy168 commented 4 years ago
  1. Find the installation directory of the extension. e.g. %USERPROFILE%\.vscode\extensions\actboy168.lua-debug-1.25.5
  2. Open this comment script/frontend/main.lua#L25
  3. Run again, you can find the log file client.log in the extension directory.
  4. Please send me the log.
bleachkitty commented 4 years ago

Here you go. client.log

actboy168 commented 4 years ago

According to the log, lua-debug tells VSCode to pause at C:/bob/proj/dev/dl/Journey/bin/Data/global/Scripts/Core/ScriptApp.lua. But VSCode thinks the path is c:/bob/proj/dev/dl/Journey/bin/data/global/Scripts/Core/ScriptApp.lua.

The first path comes from lua's chunkname, and the second path comes from VSCode. It seems that VSCode has been unable to correctly handle paths with different case since a certain version.

A quick fix is to make chunkname use the same path as VSCode, including case.

bleachkitty commented 4 years ago

YES! That was it! I really wish Windows was case sensitive like the rest of the world. Anyway, I changed the case of the chunkname and it works.

image

Thank you so much for looking into this!!

stax76 commented 2 years ago

I'm having this issue with the mpv media player.

client.log

actboy168 commented 2 years ago

@stax76 Please open a new issue.

stax76 commented 2 years ago

OK, when I do, I will provide much more details.