Added an option to use a local arduino-cli.yaml to add, for example, custom library paths. Which is a common request. #59
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Many people on the web can't find a solution to make the Arduino-CLI look for their custom libraries in a specific location for each of their projects.
I propose an option to have the extension look for a local arduino-cli.yaml file at the root of the project in order to be able to define these paths (and also further customize the behavior of the Arduino-CLI according to each project).
For reference, here is the list of possibilities offered by this configuration file: https://arduino.github.io/arduino-cli/latest/configuration/
Background:
Since the loss of compatibility with the Arduino IDE with version 2 and the mandatory use of the Arduino-CLI, many people have the problem that they do not know how to include their custom libraries anymore:
microsoft#1653 (comment)
It used to be possible to place an arduino-cli.yaml file at the root of the project:
microsoft#1614 (comment)
https://arduino.github.io/arduino-cli/0.22/configuration/#locations
Unfortunately, for security reasons, the latest versions of the Arduino-CLI no longer support the use of a local file.
arduino/arduino-cli#758
https://arduino.github.io/arduino-cli/1.1/configuration/#locations
Since February 2023, only the use of environment variables and the --config-file option are supported.
The only viable solution is to add an arduino-cli.yaml file in the "Arduino15" directory on your operating system. However, there remains a problem: the paths declared in this way are global, a certain number of users are looking for a way to be able to choose the libraries to use depending on their project.
#50 (comment)
Since VSCode does not support environment variables in this context, the only solution is to modify the Arduino extension for VSCode to use the --config-file parameter of the Arduino-CLI.
So I added an option for the extension to fetch a local arduino-cli.yaml at the root of the project using the config-file parameter, thus solving the problem.