chrischau
chrischau

Reputation: 23

How do I switch language in Visual Studio Code?

I am playing with a few programming languages within Visual Studio Code. My initial language is Python, and then I added Go in there within their own respective folders. When I run the Go file, it tries to interpret with Python, which obviously would fail.

  1. Could I have different languages within the same project and separate them by different interpreter?
  2. How do I point one folder to run with Python, the other to run with Go?

Thanks.

Upvotes: 0

Views: 3346

Answers (1)

chrischau
chrischau

Reputation: 23

I've gotten it to work. The Configuration settings control what you are building. It is set within the launch.json file, and you can have different languages with the same project and run them in different interpreter/compiler.

This is what I have in my launch.json.

"version": "0.2.0",
"configurations": [
    {
        "name": "GO: Launch",
        "type": "go",
        "request": "launch",
        "mode": "auto",
        "program": "${fileDirname}",
        "env": {},
        "args": []
    },
    {
        "name": "Python: Current File",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "console": "integratedTerminal"
    }

]

Upvotes: 2

Related Questions