Skip to content

Pylance features are not working when debugger is attached to file outside workspace #688

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

Open
Andrej730 opened this issue Apr 6, 2025 · 1 comment
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@Andrej730
Copy link

Andrej730 commented Apr 6, 2025

  1. Save the snippet below, set breakpoint at bar() and then run it (not in debug mode).
  2. Attach debugger.
  3. Try to go to definition for bar or foo. ctrl-click is not working and go to definition is not present in context menu.
  4. If you hover over variable it says use 'Alt' to show editor language tooltip but it's not working.
    Image
  5. Syntax highlight itself looks weirdly - apparently the problem is that symbols are not recognizes as such and modules / methods / functions appear just as white, making it harder to read.

Snippet:

import debugpy


def foo():
    print("hello")


def bar():
    foo()


debugpy.listen(5678)
debugpy.wait_for_client()
bar()

Issue demo:

Code_-_Insiders_4bX4iRJKcA.mp4

Expected result (for it to work in similar way to starting debug mode from editor):

Code_-_Insiders_y5fA2ARhqm.mp4
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Apr 6, 2025
@Andrej730 Andrej730 changed the title Go to definition, editor language tooltips (and other code navigation features) are not working when debugger is attached Pylance features are not working when debugger is attached to file outside workspace Apr 19, 2025
@Andrej730
Copy link
Author

I was able to narrow it down further - the issue occurs when python file you attach to is outside the current workspace (justMyCode setting is disabled, so it shoudn't get in the way).

In my case I have a main repository I'm working on (e.g. C:\repo\xxx) and for the development I need to see the changes live as part of another software yyy.
To achieve it, I've symlinked C:\yyy\xxx to C:\repo\xxx. But since I use C:\yyy\main.py to start the program, then from debugger's POV it appears like I'm working with the files outside of my workspace (C:\yyy\xxx), which leads me to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

1 participant