-
Notifications
You must be signed in to change notification settings - Fork 145
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
Hitting a breakpoint in symlinked file opens a new instance of the file #1495
Comments
this is the same as microsoft/ptvsd#2094 which also links 3 other issues of the same nature |
as this thread mentioned Symbolic links to folders can lead to the same file opened in two tabs #100533, you could add pathMapping option in you debugpy launch.json. for me example: i add pathMapping option in my launch.json, and when remote on port 5678, vscode can be: {
"name": "Python: Remote Attach",
// python -m debugpy --listen 5678 --wait-for-client train.py --arg1 ARG1
// then run the code whih this launch.json
"type": "debugpy",
// attach
"request": "attach",
"justMyCode": false,
"connect": {
"host": "localhost",
"port": 5678
},
"pathMappings": [
{
"localRoot": "/home/yourname", // your project prefered path, usually symlinked path
"remoteRoot": "/usr/local/yourname" // another path
}
]
}, however, i have only test when remote debug client and server is on the same machine. and this only work in debugpy situation, not for search return two results, or run bash command: code xxxfile open two tab. A guess, everytime debugpy request for symlinked file (this always happen), then it change to request for true file according to the pathMapping. As a consequence, vscode get file open request against true file( the key is that the request path should be as same as the project path in vscode). |
I don't think path mappings should be needed when there's no container or remote connections involved. If you're just debugging local code which happens to be symlinked, VSCode should be smart enough to follow the symlink if needed, no matter if you set the stop point in the symlinked or original files. |
Type: Bug
Behaviour
Expected vs. Actual
I develop addons for an open source project, in order to have all standard files + my customised addons files I open the project repository and have a symlink to my custom addons directory. Using breakpoints in those files always open a new tab.
When I open the file for working, the path is /dev/my_custom_addon/.../file.py
which is a symlink to
my_home/work/dev/...
which is also the path that my debugger opens when hitting the breakpoint i.e. not the short symlink path but the absolute path
Steps to reproduce:
Expected Behavior:
Do not open the same file from the symlinked path. Stop the debugger in the same file where I put my breakpoint.
Diagnostic data
python.languageServer
setting: DefaultOutput for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)User Settings
VS Code version: Code 1.85.1 (0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2, 2023-12-13T09:47:11.635Z)
OS version: Linux x64 5.15.0-91-generic snap
Modes:
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
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Extensions (32)
(1 theme extensions excluded)
A/B Experiments
The text was updated successfully, but these errors were encountered: