Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request Feature: Support customize environment variable in c_cpp_properites.json #1857

Closed
453jerry opened this issue Apr 20, 2018 · 3 comments
Labels
Feature Request fixed Check the Milestone for the release in which the fix is or will be available. Language Service

Comments

@453jerry
Copy link

453jerry commented Apr 20, 2018

When a project has a lot of include path and all include path is absolute path, then maintain c_cpp_properites.json is very uncomfortable.
for example:

"name": "Win32",
            "includePath": [
                "C:/Program Files (x86)/GNU Tools ARM Embedded/7 2017-q4-major/arm-none-eabi/include",
                "C:/Program Files (x86)/GNU Tools ARM Embedded/7 2017-q4-major/arm-none-eabi/include/c++/7.2.1",
                "C:/Program Files (x86)/GNU Tools ARM Embedded/7 2017-q4-major/arm-none-eabi/include/c++/7.2.1/arm-none-eabi",
                "C:/Program Files (x86)/GNU Tools ARM Embedded/7 2017-q4-major/lib/gcc/arm-none-eabi/7.2.1/include",
                "C:/Program Files (x86)/GNU Tools ARM Embedded/7 2017-q4-major/lib/gcc/arm-none-eabi/7.2.1/include-fixed",
                "${workspaceFolder}",
                "C:/nRF5_SDK_15.0.0_a53641a/components",
                "C:/nRF5_SDK_15.0.0_a53641a/components/libraries/experimental_memobj",
                "C:/nRF5_SDK_15.0.0_a53641a/components/libraries/experimental_section_vars",
                "C:/nRF5_SDK_15.0.0_a53641a/components/libraries/balloc",
                "C:/nRF5_SDK_15.0.0_a53641a/components/libraries/experimental_log",
                "C:/nRF5_SDK_15.0.0_a53641a/components/libraries/experimental_log/src",
                "C:/nRF5_SDK_15.0.0_a53641a/components/libraries/delay",
                "C:/nRF5_SDK_15.0.0_a53641a/components/libraries/bsp",
                "C:/nRF5_SDK_15.0.0_a53641a/components/libraries/strerror",
                "C:/nRF5_SDK_15.0.0_a53641a/components/libraries/util",
                "C:/nRF5_SDK_15.0.0_a53641a/components/drivers_nrf/nrf_soc_nosd",
                "C:/nRF5_SDK_15.0.0_a53641a/components/softdevice/mbr/nrf52832/headers",
                "C:/nRF5_SDK_15.0.0_a53641a/components/boards",
                "C:/nRF5_SDK_15.0.0_a53641a/components/toolchain/cmsis/include",
                "C:/nRF5_SDK_15.0.0_a53641a/modules/nrfx",
                "C:/nRF5_SDK_15.0.0_a53641a/modules/nrfx/templates",
                "C:/nRF5_SDK_15.0.0_a53641a/modules/nrfx/mdk",
                "C:/nRF5_SDK_15.0.0_a53641a/modules/nrfx/hal",
                "C:/nRF5_SDK_15.0.0_a53641a/integration/nrfx",
                "${workspaceFolder}/config"
            ]

I hope there this a way to customize env variable in c_cpp_properites.json, it will be very easy to maintain c_cpp_properites.json, and very simple to remove project to other environment.
for example:

"name": "Win32",
            "env": {

                "ARM_GCC":"C:/Program Files (x86)/GNU Tools ARM Embedded/7 2017-q4-major",
                "NRF52_SDK":"C:/nRF5_SDK_15.0.0_a53641a"
            },
            "includePath": [
                "${ARM_GCC}/arm-none-eabi/include",
                "${ARM_GCC}/arm-none-eabi/include/c++/7.2.1",
                "${ARM_GCC}/arm-none-eabi/include/c++/7.2.1/arm-none-eabi",
                "${ARM_GCC}/lib/gcc/arm-none-eabi/7.2.1/include",
                "${ARM_GCC}/lib/gcc/arm-none-eabi/7.2.1/include-fixed",
                "${workspaceFolder}",
                "${NRF52_SDK}/components",
                "${NRF52_SDK}/components/libraries/experimental_memobj",
                "${NRF52_SDK}/components/libraries/experimental_section_vars",
                "${NRF52_SDK}/components/libraries/balloc",
                "${NRF52_SDK}/components/libraries/experimental_log",
                "${NRF52_SDK}/components/libraries/experimental_log/src",
                "${NRF52_SDK}/components/libraries/delay",
                "${NRF52_SDK}/components/libraries/bsp",
                "${NRF52_SDK}/components/libraries/strerror",
                "${NRF52_SDK}/components/libraries/util",
                "${NRF52_SDK}/components/drivers_nrf/nrf_soc_nosd",
                "${NRF52_SDK}/components/softdevice/mbr/nrf52832/headers",
                "${NRF52_SDK}/components/boards",
                "${NRF52_SDK}/components/toolchain/cmsis/include",
                "${NRF52_SDK}/modules/nrfx",
                "${NRF52_SDK}/modules/nrfx/templates",
                "${NRF52_SDK}/modules/nrfx/mdk",
                "${NRF52_SDK}/modules/nrfx/hal",
                "${NRF52_SDK}/integration/nrfx",
                "${workspaceFolder}/config"
            ],
@bobbrow
Copy link
Member

bobbrow commented May 3, 2018

This will probably make it into the next release. I have a PR open for it.

@bobbrow bobbrow added the fixed Check the Milestone for the release in which the fix is or will be available. label May 3, 2018
@bobbrow
Copy link
Member

bobbrow commented May 8, 2018

This is implemented in 0.17.0. However, the "env" is at the root of the JSON object, not in the configuration.

{
   "env": { ... },
   "configurations": { ... },
   "version": 4
}

@bobbrow bobbrow closed this as completed May 8, 2018
@453jerry
Copy link
Author

Cool ! It's very helpful. Thank your

@github-actions github-actions bot locked and limited conversation to collaborators Oct 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Feature Request fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
None yet
Development

No branches or pull requests

2 participants