2

I have recently discovered that there a gms extension in visual studio code so you can write your GAMS code there. The description of the extension says following:

Provides syntax highlighting for .gms and .inc files and shortcuts for running GAMS models

I wonder if it is possible to actually run your GAMS code from Visual Studio Code?

Kim
  • 159
  • 3
  • 11

2 Answers2

0

Yes. You have to do this from the terminal.

0

You can set up a default build task (shown below) for the current opened file (${fileBasename}) and run with ctrl+shift+b. It's possible to add arguments to the "args" array, i.e. gdx=default etc.

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Run this file with GAMS",
            "type": "shell",
            "command": "gams",
            "args": [
                "${fileBasename}"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "options": {
                "env": {
                    "PATH": "/opt/gams:${env:PATH}"
                }
            }
        }
    ]
}