Skip to content
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

Default debugging in a multiroot workspace sets working directory inconsistently #111037

Closed
jolampi opened this issue Nov 20, 2020 · 2 comments
Closed
Assignees
Labels
*caused-by-extension Issue identified to be caused by an extension debug Debug viewlet, configurations, breakpoints, adapter issues

Comments

@jolampi
Copy link

jolampi commented Nov 20, 2020

When running tasks in VS Code, the default working directory is current workspace's root folder. However, in the case of a multiroot workspace with no custom launch tasks, the debugger doesn't seem to handle files from different roots consistently. The working folder, when printed, seems to depend on which ever root the first active file was from. This causes confusing errors for example when attempting to open a file using a relative path.

Of course this could be circumvented by defining a tasks.json file for each root in the workspace. In some circumstances though, it is much more convenient to simply be able to debug the active file.

This issue occurs at least with javascript and python files (latter using the Python extension).

  • VSCode Version: 1.51.1
  • OS Version: Linux Ubuntu 19.10 64bit, Microsoft Windows 10 64-bit

Steps to Reproduce:

  1. Create a multi-root workspace with the following structure:
rootA
  fileA.js
rootB
  fileB.js
  1. Set contents of both files A and B to console.log(process.cwd()).
  2. With no launch.json present, "Run and Debug" both files with node.js while they are active.
  3. The expected behavior is for fileA to print rootA and for fileB to print rootB. Instead the outcome is same in both scenarios and appears to depend on whichever file was active first.

Does this issue occur when all extensions are disabled?: Yes

@jolampi jolampi changed the title Default debugging in a multiroot workspace doesn't Default debugging in a multiroot workspace sets working directory inconsistently Nov 20, 2020
@weinand
Copy link
Contributor

weinand commented Oct 12, 2021

VS Code does not set the "working directory" for a debugging session. If this is important for a specific debugger, then the corresponding debug extension should set the "working directory" automatically or support a "cwd" property in the corresponding launch config.

I suggest that you file issues against the debuggers that have a problem in this area.

@weinand weinand added debug Debug viewlet, configurations, breakpoints, adapter issues *caused-by-extension Issue identified to be caused by an extension labels Oct 12, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Nov 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*caused-by-extension Issue identified to be caused by an extension debug Debug viewlet, configurations, breakpoints, adapter issues
Projects
None yet
Development

No branches or pull requests

3 participants
@weinand @jolampi and others