Skip to content

VS Code Flexible Configurations #42

@douglowe

Description

@douglowe

While adapting the Run Configuration example for VS Code I came across this stackoverflow answer on optional inputs for run configurations: https://stackoverflow.com/questions/43704747/visual-studio-code-run-python-file-with-arguments

It links to VS Code Variables Reference: https://code.visualstudio.com/docs/editor/variables-reference

Following these I created the following configuration file:

{
    "version": "2.0.0",
    "configurations": [
        {
            "name": "Catchment-analysis: Any",
            "type": "python",
            "request": "launch",
            "args" : [ "${input:dataFile}" ],
            "module": "catchment-analysis",
            "console": "integratedTerminal",
            "justMyCode": True            
        }
    ]
    "inputs": [
        {
            "type": "promptString",
            "id": "dataFile",
            "description": "Chose input file",
            "default": "data/rain_data_2015-12.csv"
        }
    ]
}

This is much more flexible than the current configuration (and could be combined with the current configuration if we want to keep some easy to use configs still). Should we switch to this for our course, or will it be too complicated?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions