microsoft / vscode-arduino

Visual Studio Code extension for Arduino
Other
1.17k stars 226 forks source link

ArduinoCLI "_packagePath" doesn't use arduino-cli.yaml #1623

Open bruyeret opened 1 year ago

bruyeret commented 1 year ago

I have an arduino-cli installed at some path/to/arduino-cli/arduino-cli.exe. I also have a arduino-cli.yaml in %LOCALAPPDATA%/Arduino15/. This folder is empty except for the arduino-cli.yaml. This yaml file specifies a "data" folder containing the package_index.json and other things.

When I go in the board manager and click "Refresh Package Indexes", I see that the package_index.json is updated in the "data" folder specified by my arduino-cli.yaml and contains a lot of boards. The problem is that the board manager of the extension shows 0 board.

I found out what is happening: the code looking for the "data" folder containing the package_index.json is here. It is not looking for my yaml configuration file and doesn't find the right "data" folder.

As it is checking if a "portable" folder exists at the same location as the arduino-cli.exe, a workaround is to create this "portable" folder in path/to/arduino-cli and specify this directory in the yaml file for "data". But it does not allow to use a custom fancy folder.

Is it possible to add support for configurations as described here? Or at least document the fact that the extension does not support configurations but that there is a "portable folder workaround"?

Henry-Jones commented 1 year ago

The same goes for a portable installation of VSC: There is no way to add the --config-file option to the command line of Arduino-CLI.exe to have the arduino data folders portable as well.

It is also possible to set the configuration options as environment variables (mentioned on your second link), but I did not test yet if they would be honored by the addin this way. I'm just creating the Arduino environment in VSC.

Addendum: The environment variables are honored by the Arduino-CLi itself. Downloads from the board manager are stored in the correct folders. But the Plugin does not see them there or may be more likely it does not care.

There is a command parameter to get where the Arduino-CLI stores the files "config dump". Maybe this could be used to get the correct folders from the plugin side.