Skip to content

${configurationName} variable - support #1444

Closed

Description

@witM

Microsoft, please do support for variable that holds current configuration name selected from cpp_property.json file for Visual Studio and Visual Code available in tasks This for example be: ${configurationName}. This is very needed and I wonder why you didn't do that (maybe did?) Do that should be simple update so please to make this.

Activity

  1. sean-mcmanus commented on Jan 16, 2018

    @sean-mcmanus
    Contributor

    I don't think extensions have a way of adding task variables, so someone would need to get VS Code to add this ability. You may be able to work around this by using an environment variables of the form ${env:configurationName} and then somehow changing the value of the environment variable when a configuration changes, such as via adding code in onSelectedConfigurationChanged in https://github.com/Microsoft/vscode-cpptools/blob/master/Extension/src/LanguageServer/client.ts , but if we want this change to be shipped in the product, it seems like the name of the environment variable would need to be a setting so that it's customizable.

  2. sean-mcmanus commented on Jan 26, 2018

    @sean-mcmanus
    Contributor

    This can be implemented in our open source code via adding a C_Cpp.configuration setting and the using ${config.C_Cpp.configuration} in your task.json. The config index is currently saved in the workspace "persistent state". I agree it would be good to add, but I'm not sure when we'll get around to it yet due to higher priority tasks.

  3. witM commented on Jan 26, 2018

    @witM
    Author
  4. bobbrow commented on Sep 9, 2019

    @bobbrow
    Contributor

    You can use ${command:cpptools.activeConfigName} to get the value of the active configuration. Is that what you were asking for?

  5. locked and limited conversation to collaborators on Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions