-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debug issue with typescript, nodemon, and external projects #169033
Comments
Update... I was able to make a change in my launch.json file that helped. I overwrote the outFiles section like this...
The trick was to point go up a folder to point to the external project. I found this by accident, so could the documentation on this be improved? It would be helpful to better understand the internal workings. In my larger project, I made this same change and was also able to debug. However, it's hit and miss when it comes to debugging. Sometimes it works, but mostly it doesn't. I restart vs code, restart my projects, etc. When it doesn't work, it says it can't find the source code even though it's there. I also see the message that "It's taking a while to configure your breakpoints. You can speed this up by updating the 'outFiles' in your launch.json". I've done that similar to the code above. My real project is a bit of a mono-repo. It contains 4 typescript projects, 5 nodejs servers, and an angular app. I usually have tsc --watch enabled for the typescript projects and use nodemon on the servers. Is there an upper limit on the number of files that vs code can handle with debugging? Are there some performance metrics I could run to see why the debugger can't find the source files? |
Yea, the
There is no upper limit. I would check to make sure that you didn't accidentally include any big extraneous folders in your outFiles -- and ensure the negation for node_modules is still there. Logs might help... /jsDebugLogs |
Please collect trace logs using the following instructions:
|
Thanks for your help Connor! I did find that link explaining the sourcemap files. Perhaps the piece I was missing is where "workspaceFolder" actually points to. I had assumed it was one level higher than it was, but it turns out it points to the folder containing the .vscode folder. I've run the debugger with the trace and attached that file. This is from the larger project, not the sample repo I originally posted about. I did notice one thing earlier that helped. The nodejs server that I'm running uses our shared code from the other typescript projects. The package.json for our server contains dependencies like this:
If I start vs code and simply run the server, the debugger cannot find any breakpoints. However, if I start vs code, start the watch process for our shared typescript projects...
... and then start the server, I have a much higher chance of vs code finding my breakpoints. I've attached a trace for the one that works as well (second attachment with the "-works" in the file path). Thank you! I'd love to know more about how this works so I can improve our environment. vscode-debugadapter-3ecd154d.json.gz |
Does adding an extra negation for |
Hey, that did help some! It definitely performs better, good call! I am now seeing my breakpoints find the source a little over half the time. I managed to get a trace for both when it worked (first link) and when it was broke (2nd link). vscode-debugadapter-e619ebd7.json.gz |
Good to know. The glob behavior is something we can improve, automatically applying it if we see a relative pattern navigates outside the workspace folder.
Are you sure you're connecting to the right process in the broken one? Looking at the scripts loaded by the runtime in the trace log, they're mostly from |
I think this one is still unexpected. I've opened issues to track the other two improvements we've talked about. |
Ok, I've run through those scenarios and generated traces. The file labels match these scenarios:
vscode-debugadapter-ff37efdf-1-nodemon-broken.json.gz |
This looks like Nodemon again 😬 you can also see the scripts if you use the Loaded Sources view. |
Ya, that makes sense. It appears that if I debug the wrong process to begin with, I have to restart my server before attaching to the correct process. Now that I know this, I feel better about debugging. Thanks for your help! |
No problem, thanks for your patience and info 🙂 I will close this out since I captured the work in the aforelinked issues. |
Type: Bug
Thank you for anyone who is able to offer some insight about what is going on. VS Code debugging has always been finicky, but I've got a situation that I think should work and it isn't.
Issue:
I can set breakpoints in typescript and debug in 2 of my projects (server and common-internal), but not the 3rd (common-external). Why can't I debug common-external, and how do I set it up so I can? VS Code cannot find the source to bind the breakpoint.
I've created a simple repo to reproduce the issue I'm seeing: https://github.com/snotmare/debug-issue
Steps to reproduce:
Project setup:
External project setup:
The server project depends on the 2 common projects like this:
I believe the issue is related to the folder structure, which looks like this:
The folder structure needs to be this way because I want test-app to be in a git repo while common-external is in a separate git repo.
When I debug the server, why can't I set a breakpoint in common-external and debug it? Thank you for your help!
Ben
VS Code version: Code 1.74.0 (5235c6b, 2022-12-05T16:38:16.075Z)
OS version: Windows_NT x64 10.0.22000
Modes:
Sandboxed: No
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Extensions (11)
A/B Experiments
The text was updated successfully, but these errors were encountered: