23

I am using Don Jayamanne's Python extension and it is working well. The only issue I have is for every project I work on, I have to copy the \.vscode\launch.json file. I was wondering if there is a way to place that file somewhere globally so the settings are applied to all my projects. Something similar to how the global settings.json works for user settings.

In other words I am looking for a way to avoid having to copy \.vscode\launch.json to every folder I store and write python code in.

0

2 Answers 2

38

Yes, it is possible - you need to put the requisite launch config directly in your user settings file, as described here.

From the linked page:

... currently it is not possible to have one global launch.json file which would be used everywhere, but what works is to add a "launch" object inside your user settings (preferences > user settings). This way it will be shared across all your workspaces
Example:

"launch": {
    "version": "0.2.0",
    "configurations": [
        {
        "type": "node",
        "request": "launch",
        "name": "Launch Program",
        "program": "${file}",
        "cwd": "${workspaceRoot}",
        "runtimeExecutable": "/usr/local/bin/node"
        }
    ]
}
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you. This worked. All you have to do is paste your "launch" settings into your user settings file (settings.json).
its is not working now maybe they did some changes (for inputs)
1

See https://code.visualstudio.com/docs/debugtest/debugging-configuration#_global-launch-configuration

VS Code supports adding a "launch" object inside your User settings. This "launch" configuration will then be shared across your workspaces. For example:

"launch": {
    "version": "0.2.0",
    "configurations": [{
        "type": "node",
        "request": "launch",
        "name": "Launch Program",
        "program": "${file}"
    }]
}

Historical note: According to other writings, in certain older versions of VS Code, if your workspace had its own .vscode/launch.json, the global launch configs would be ignored, but it seems that this is no longer true in the latest versions (I tried on 1.78) for the user settings.json. It is still true that the workspace settings.json's launch property will be ignored if you have a launch.json file in your workspace.

https://code.visualstudio.com/docs/editor/variables-reference will probably also be useful to you.

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.