Skip to content

Configuration Reference

How to configure the extension

If you want to modify the configuration for the current workspace (folder), simply create a .vscode/settings.json file.

If you want to apply the configuration to all workspaces, press Ctrl + , to open the VS Code settings, then click the "Open Settings (JSON)" button in the top right corner to open the global configuration file:

oi-runner-2.tasks

Defines the tasks available in the run panel and their corresponding compilation and execution commands.

Format:

jsonc
{
  "oi-runner-2.tasks": {
    "C++": { // Task label
      "compile": [ // Compilation command and arguments
        "g++",
        ["${file}", "-o${fileNoExt}", "-std=c++14", "-O2"] // The use of ${} is explained below
      ],
      "execute": [ // Execution command, required
        "${fileNoExt}${execExt}",
        []
      ]
    },
    "Python": {
      // The compilation command can be empty; the compile button will not be displayed when this task is selected
      "execute": [
        "python",
        ["${file}"]
      ]
    }
    // ...
  }
}

There are special strings in the commands and arguments that will be replaced with actual information when executed:

Special StringReplaced With
${file}The absolute path of the source file
${fileNoExt}The absolute path of the source file without the extension
${execExt}The extension of the executable file, .exe on Windows, an empty string on other systems

The working directory is the opened folder.

oi-runner-2.defaultTask

Defines the default task selected in the run panel when a file is opened.

Format:

jsonc
{
  "oi-runner-2.tasks": {
    "C++": { /* ... */ },
    "Python": { /* ... */ }
  },
  "oi-runner-2.defaultTask": {
    ".py": "Python" // Files with the .py extension default to Python
    // Others default to the first task defined in oi-runner-2.tasks, which is C++ in this example
  }
}

oi-runner-2.addToRunMenu

Whether to add OI Runner++ to the editor title menu.

If disabled, you need to press Ctrl + Shift + P and search for Launch OI Runner++ to open the run panel.

Format: true (default) or false.

Released under the MIT License.