9

How do I set my workspace folder in Visual Studio Code?

This appears to be necessary for debugging, and I suspect it's why my breakpoints aren't getting hit.


Further reading:

  1. This question about adding workspaces doesn't have an accepted answer.
  2. What is a 'workspace' in VS Code?, while providing a wealth of information, does not explain how to set a workspace for debugging.
  3. User and Workspace Settings. The documentation also does not mention how to set a workspace for debugging.

2 Answers 2

4

How do I set my workspace folder in Visual Studio Code?


  1. Open Visual Studio Code. You should be on the Welcome page.
  2. Add workspace folder...

Add workspace folder link

  1. File explorer opens. Select the folder you want for your workspace. Add.


Now your workspace folder is shown in the left pane :-)

workspace folder

Sign up to request clarification or add additional context in comments.

3 Comments

Can we launch a workspace from the command line? e.g. code ./hello-world.code-workspace
After reviewing the docs > User Guide > Command Line and Multi-Root Workspaces, I found nothing. Maybe there is a round-about way...
If there are more than one workspace folder, does it take the first one? I think I have to move the folder I want to the iop.
2

Create a launch.json and set your workspace in "cwd"

 { "version": "0.2.0", "configurations": [ { "name": "Python: Current File", "type": "python", "request": "launch", "stopOnEntry": true, "pythonPath": "${config:python.pythonPath}", "program": "${file}", "cwd": "*your/new/workspace/*", "env": {}, "envFile": "${workspaceFolder}/.env", "debugOptions": [ "RedirectOutput" ] } ] } 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.