Clang and OpenOCD binaries in PATH #1666
Merged
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.
Make sure esp-clang and openocd include esp-clang and openocd-esp32 in their resulting binary path.
Update clang query driver to **
Fix compile-commands-dir using the wrong workspace when using the new project wizard.
Make sure OPENOCD_SCRIPTS matches the same from openOCD in PATH.
Remove venv and pip validation on setup wizard
Description
This pull request introduces several improvements and code cleanups related to binary detection and environment setup for ESP-IDF tools, especially around OpenOCD and Clangd integration. The changes enhance how the code locates tool binaries, sets up environment variables, and removes unnecessary Python environment checks.
Binary detection and environment setup improvements:
isBinInPathutility to accept an optionalcontainerDirparameter, allowing it to more precisely detect binaries within specific directories (e.g., "esp-clang" or "openocd-esp32") and return the correct path only if the binary is in the intended container. [1] [2]appendIdfAndToolsToPathto automatically set theOPENOCD_SCRIPTSenvironment variable if the OpenOCD binary is found, improving script path configuration for debugging tools.OpenOCD and Clangd integration:
isBinInPath(with "openocd-esp32" as a container), ensuring the correct binary is used for version checks and server spawning. [1] [2] [3]Python environment checks cleanup:
pipandvenvexistence from both the Python manager and setup/install steps, streamlining the setup process and reducing unnecessary error handling. [1] [2] [3] [4]Miscellaneous:
These changes collectively make the ESP-IDF extension's toolchain setup more robust and maintainable, especially in environments with multiple tool versions or custom installations.
Fixes #1596
Fixes #1661
Type of change
Please delete options that are not relevant.
Steps to test this pull request
Having openocd in /usr/bin/openocd or /usr/bin/clangd in PATH, when running
OpenOCD serverorESP-IDF: Configure project for ESP-Clangit should use the executable from IDF_TOOLS_PATH instead of /usr/bin.ESP-IDF: New Projectwizard to create a new project.--query-driver=**and--compile-commands-dir=pointing to the current esp-idf project build directory. Before it was pointing to directory used to runESP-IDF: New Project.Expected behaviour:
Clang settings in vscode/settings.json are
--query-driver=**and--compile-commands-dir=points to current project build directoryOpenOCD and clangd are used from IDF_TOOLS_PATH instead of system (/usr/bin for example)
Expected output:
How has this been tested?
Manual testing using steps above.
Test Configuration:
Checklist