Home > Enterprise >  VSC platform-specific settings
VSC platform-specific settings

Time:10-26

My settings.json on Linux machine contains setting lines for cortex-debug extension:

    "cortex-debug.armToolchainPath": "/opt/gcc-arm-none-eabi/bin/",
    "cortex-debug.JLinkGDBServerPath": "/opt/SEGGER/JLink_V754b/JLinkGDBServerCLExe",

The same file on Windows machine should refer to a different file name JLinkGDBServerCL.exe (yes, I understand such dumb naming is guilty of Segger, but...)

When settings sync turned on, I continuously get the wrong config on one (Windows or Linux) machine.

Is it possible to set a platform-specific section in settings.json to define a different key for an extension?

CodePudding user response:

One way is to use VSCode's features to define machine specific settings or prevent certain settings from being synced,

https://code.visualstudio.com/docs/editor/settings-sync#_configuring-synced-data

CodePudding user response:

Ok, found another solution for my problem.

At first, install platform-settings from marketplace:

https://marketplace.visualstudio.com/items?itemName=runarsf.platform-settings

Next, move required settings to a new place:

"platformSettings.platforms": {
    "win32": {
        "cortex-debug.armToolchainPath": "C:/Program Files (x86)/GNUARM/bin/",
        "cortex-debug.JLinkGDBServerPath": "JLinkGDBServerCL.Exe",
    },
    "linux": {
        "cortex-debug.armToolchainPath": "/opt/gcc-arm-none-eabi/bin/",
        "cortex-debug.JLinkGDBServerPath": "/opt/SEGGER/JLink_V754b/JLinkGDBServerCLExe"
    }
}

But variant with sync prevention looks pretty good.

  • Related