raspberrypi / pico-vscode

The official VS Code extension for Raspberry Pi Pico development. It includes several features to simplify project creation and deployment.
https://marketplace.visualstudio.com/items?itemName=raspberry-pi.raspberry-pi-pico
Mozilla Public License 2.0
131 stars 16 forks source link

Importing removes custom extensions #121

Closed trautb closed 1 week ago

trautb commented 1 week ago

Expected Behavior

When importing an existing project the neccessary extensions are added to .vscode/extensions.json, prior defined "custom" extensions should remain.

Current Behavior

When importing an existing project .vscode/extensions.json gets overridden by the default configuration (independent of prior settings).

Steps to Reproduce

  1. Get pico project
  2. Add extension to .vscode/extensions.json
  3. Import project via Pico extension

Details

Specifically this .json

{
    "recommendations": [
        "marus25.cortex-debug",
        "ms-vscode.cpptools",
        "ms-vscode.cpptools-extension-pack",
        "ms-vscode.vscode-serial-monitor",
        "raspberry-pi.raspberry-pi-pico",
        "trunk.io",
    ]
}

gets changed to

{
    "recommendations": [
        "marus25.cortex-debug",
        "ms-vscode.cpptools",
        "ms-vscode.cpptools-extension-pack",
        "ms-vscode.vscode-serial-monitor",
        "raspberry-pi.raspberry-pi-pico",
    ]
}

Context (Environment)

will-v-pi commented 1 week ago

This probably applies to the other .vscode/*.json files too (eg settings.json)

paulober commented 1 week ago

This probably applies to the other .vscode/*.json files too (eg settings.json)

Right, I have now added support for merging the recommended extensions. Merging the existing settings can be a bit more complicated as we need to account for each subkey. Probably by switching to the json module to convert between python types and json strings we could get support for keeping settings and such. Although I'm not sure if we really want that for all files like c_cpp_properties.json?