kit icon indicating copy to clipboard operation
kit copied to clipboard

VSCode inline breakpoint debug is not working

Open ondrejrohon opened this issue 1 year ago • 1 comments

Describe the bug

breakpoints added using VSCode UI are unbound, execution doesn't stop at them. However inline debugger statement works, but stops in transpiled js instead of my original typescript file: CleanShot 2024-08-28 at 18 41 41@2x CleanShot 2024-08-28 at 18 42 01@2x

Reproduction

  • scaffold base sveltekit repo, use typescript
  • follow steps from oficial guide https://kit.svelte.dev/docs/debugging#visual-studio-code-launch-via-debug-pane
  • in +layout.server.ts add an inline breakpoint to line 5, execution should stop there when page is requested

Sample repository: https://github.com/ondrejrohon/sveltekit-debug-vscode

Logs

No response

System Info

Visual Studio Code

Version: 1.92.2
Commit: fee1edb8d6d72a0ddff41e5f71a671c23ed924b9
Date: 2024-08-14T17:29:30.058Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Darwin x64 23.6.0

Severity

annoyance

Additional Information

No response

ondrejrohon avatar Aug 28 '24 16:08 ondrejrohon

CleanShot 2024-08-28 at 21 51 44@2x now I noticed, that there is a warning icon in breakpoints section in debug tab. Question is, why VSCode can't find +layout.server.ts?

ondrejrohon avatar Aug 28 '24 19:08 ondrejrohon

It might be a problem with the whitespace in your path. If I tried in a directory with space in the path the debugger stopped at the virtual file but when I removed the space it worked as expected. Can you confirm if this is the case? If so you should create an issue in vite. it might be the whitespace in the sourceURL needs to be escaped.

jasonlyu123 avatar Aug 30 '24 05:08 jasonlyu123

Yes, I confirm that removing the whitespace fixes the issue. Moving this issue to Vite: https://github.com/vitejs/vite/issues/17977

@jasonlyu123 thanks so much for help! :)

ondrejrohon avatar Aug 30 '24 07:08 ondrejrohon