iarsystems / iar-vsc-build

Visual Studio Code extension for developing and building IAR projects
https://marketplace.visualstudio.com/items?itemName=iarsystems.iar-build
Mozilla Public License 2.0
38 stars 5 forks source link

Overwriting settings in ".vscode\iar-vsc.json" #74

Open WalterNa opened 8 months ago

WalterNa commented 8 months ago

Describe the bug: We have a folder structure with many .eww and .ewp files in the project repository and also the IAR EWARM binaries (everything-as-code). Trying to pre-define the IAR path in ".vscode\iar-vsc.json" (this file shall also go to repository) "workbench": { "path": ${workspaceFolder}\..\..\iar_ewarm"

Settings always get overwritten with the extion of the real path (or some other IAR installation found somewhere). With predefined values in "workspace" and "workspaces" the same things happen: the extension overwrites the values with some other files it finds in some folders.

To Reproduce: see description

Expected behavior: Extension should exactly do what is defined in ".vscode\iar-vsc.json" and not try to guess something else.

Actual behavior: The extension changes the file content with what it finds on disk

Environment:

Additional context: I can understand that you try to auto-detect things, but this should not overwrite existing stuff. Maybe you could introduce some preference-switch for disabling this mechanism for people who don't want that auto-detection at all

HampusAdolfsson commented 8 months ago

Hi,

The iar-vsc.json file stores the user's selection of workbench, workspace, project and project configuration in the "Extension Configuration" view. If you change a value in one of the dropdowns, you can see it change in iar-vsc.json On startup, the extension matches the values in iar-vsc.json with what it finds on disk to try to restore the selections from the last session. If it doesn't find a match, it auto-selects a value. The file is thus machine-specific and not intended to be checked into version control. However, we might be able to support your use case in some other way.

If you simply want to set which workbench is auto-selected the first time the folder is opened in VS Code, your current approach should work. If set the workbench path in iar-vsc.json, add it to version control and then (git)ignore it, the extension will default to that workbench when you check out a fresh copy of the repository.

Alternatively, I can see the utility in being able to associate a workspace with a specific version of Embedded Workbench. That way, when opening a fresh copy of the repository, the auto-selection can figure out that it should use the EWARM installation in the repository rather than some other (potentially newer) EWARM installation on the machine.

Would either of these solutions address your use case?