Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.
like image 573
Super Jade Avatar asked May 26 '26 03:05

Super Jade


2 Answers

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

like image 152
Super Jade Avatar answered May 30 '26 13:05

Super Jade


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"
            ]
        }
    ]
}
like image 30
Alex Avatar answered May 30 '26 12:05

Alex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!