tomblind / local-lua-debugger-vscode

Local Lua Debugger for VSCode
MIT License
107 stars 26 forks source link

Problems with captialzation in file names on Windows #57

Open sewbacca opened 2 years ago

sewbacca commented 2 years ago

When I put breakpoints in a file with capitalization i can't put breakpoints in. e. g.:

main.lua

local foo = require "Foo"
foo()

Foo.lua

return function()
   return 0 -- Put here a breakpoint
end

If I step in, i get redirected to a file called foo.lua which does not exist. Probably has something to do with ntfs handling files as if they were all lowercase and using capitalization as a display name.

sewbacca commented 2 years ago

Maybe i was encountering this issue in #55.

tomblind commented 2 years ago

I can't seem to reproduce this. What version of lua are you using (or are you using a custom environment like love)?

sewbacca commented 2 years ago

Weird, now I seem not to be able to reproduce it either. The only thing that i notice if i rename it to foo.lua, set a breakpoint and run it again, the captalization in the tab, will turn from foo.lua to Foo.lua. I was using plain Lua 5.3 to reproduce the example, since then I remember at least 1 update, maybe this issue was vscode related.

tomblind commented 2 years ago

It does seem vscode related. On windows filenames are not case-sensitive, so it should load the file regardless of case.

sewbacca commented 2 years ago

I'VE GOT A ***** TEST CASE!!! Sorry, but this bug is annoying. So: Create a Project, create a new file, called Myfile.lua. Delete Myfile.lua and create a new file called myfile.lua. Create a test function that is returned as a module and require it from a file that is launched when debugging. Set a breakpoint in myfile.lua that should hit. Debug. I tested this on Windows 10 VSCode 1.66.2. I noticed that the breakpoint, even though the file is called myfile.lua, it is set in the debug inspector to Myfile.lua. I bet this must be the issue.

main.lua


local file = require "myfile"

file.run()

myfile.lua

return {
    run = function ()
        return 1
    end
}

BTW I like your extension, even with it's quirks, it serves me well :D

EDIT:

So I now deleted my workspace storage and it seems to rescan the directory. When I put the breakpoint now, it will have correct captialization. I have no idea why this fixes it.