microsoft / microsoft/vscode-cpptools

The ability to reference data in configurations in tasks.json

Open
#7,456 5 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Request Feature: Configuration Language Service tasks/build/debug
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Type: Feature Request

A method of being able to reference a C/C++ configuration you have created in the tasks.json file to enable the passing of information and reduce the amount of work needed to keep tasks and configs the same.

Example usage:

{
  "version": "2.0.0",
  "tasks": [
    {
      "type": "shell",
      "label": "C/C++: g++.exe build all files",
      "configuration": "GCC"      <--- Line is needed when referencing configuration data and must match the name of a configuration
      "command": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",
      "args": [
        "-g", 
        "${workspaceFolder}/*.cpp",
        "-L${configurationLibraryDirectory}",  <-- Functions as a wildcard for the library directories
        "-l${configurationsLibraries},         <-- Functions as a wildcard for the libraries
        "-D${configurationDefines}",           <-- Functions as a wildcard for the compiler defines
        "-o", 
        "${workspaceFolderf}/out.exe"],
      "options": {
        "cwd": "${workspaceFolder}"
      },
      "problemMatcher": ["$gcc"],
      "group": {
        "kind": "build",
        "isDefault": true
      }
    }
  ]
}

The intention here would allow the user to add information straight from the configuration and pass that into the build command. There will be an error/warning if you try to reference a configuration without a name and any tasks that the user runs without adding the configuration name will ignore all configuration args. Additionally upon calling a build task that has a configuration referenced IntelliSense should automatically swap to that configuration if it isn't already selected. This should overall save time in maintaining the IntelliSense file and tasks file by only needing to change one file.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tasks.json and the C/C++ configuration and IntelliSense behavior described in the request. Define how a named configuration is referenced by a build task, how missing names are warned about or ignored, and when IntelliSense switches configurations. Done means task arguments and configuration data remain synchronized through the requested reference mechanism.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript
Domain
build-system, developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.