installed ESP-IDF tools are not detected (VSC-1256) #1092
Description
OS
Windows
Operating System version
Microsoft Windows [Version 10.0.22631.2715]
Visual Studio Code version
1.85.0
ESP-IDF version
v5.1.2,master
Python version
3.11.3
Doctor command output
---------------------------------------------- ESP-IDF Extension for Visual Studio Code report ---------------------------------------------
OS win32 x64 10.0.22631
System environment variable IDF_PYTHON_ENV_PATH
undefined
System environment variable PATH
C:\Program Files\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\PuTTY;C:\Program Files (x86)\Microsoft Emulator Manager\1.0;C:\Program Files\CMake\bin;C:\Program Files\dotnet;C:\Program Files\Git\cmd;C:\Program Files\nodejs;C:\Program Files (x86)\Bitvise SSH Client;C:\AppData\Local\Microsoft\WindowsApps;C:\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files (x86)\Nmap;C:\AppData\Local\JetBrains\Toolbox\scripts;C:\AppData\Local\Programs\Python\Python311;C:\AppData\Local\gitkraken\bin;C:\AppData\Local\GitHubDesktop\bin;c:\work\tools;C:\AppData\Roaming\npm;
System environment variable PYTHON
undefined
Visual Studio Code version 1.85.0
Visual Studio Code language en
Visual Studio Code shell C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
ESP-IDF Extension version 1.6.5
Workspace folder c:\work\clients\alm\alm-x2
---------------------------------------------------- Extension configuration settings ------------------------------------------------------
ESP-ADF Path (idf.espAdfPath) ${env:ADF_PATH}
ESP-IDF Path (idf.espIdfPath) C:\work\esp32\esp-idf
ESP-MDF Path (idf.espMdfPath) ${env:MDF_PATH}
ESP-Matter Path (idf.espMatterPath) ${env:ESP_MATTER_PATH}
Custom extra paths (idf.customExtraPaths) c:\work\esp32.espressif\tools\xtensa-esp-elf-gdb\12.1_20231023\xtensa-esp-elf-gdb\bin;c:\work\esp32.espressif\tools\riscv32-esp-elf-gdb\12.1_20231023\riscv32-esp-elf-gdb\bin;c:\work\esp32.espressif\tools\xtensa-esp-elf\esp-13.2.0_20230928\xtensa-esp-elf\bin;c:\work\esp32.espressif\tools\riscv32-esp-elf\esp-13.2.0_20230928\riscv32-esp-elf\bin;c:\work\esp32.espressif\tools\esp32ulp-elf\2.35_20220830\esp32ulp-elf\bin;c:\work\esp32.espressif\tools\cmake\3.24.0\bin;c:\work\esp32.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\bin;c:\work\esp32.espressif\tools\ninja\1.11.1;c:\work\esp32.espressif\tools\idf-exe\1.0.3;c:\work\esp32.espressif\tools\ccache\4.8\ccache-4.8-windows-x86_64;c:\work\esp32.espressif\tools\dfu-util\0.11\dfu-util-0.11-win64;c:\work\esp32.espressif\tools\esp-rom-elfs\20230320
Custom extra vars (idf.customExtraVars)
OPENOCD_SCRIPTS: c:\work\esp32.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921/openocd-esp32/share/openocd/scripts
IDF_CCACHE_ENABLE: 1
ESP_ROM_ELF_DIR: c:\work\esp32.espressif\tools\esp-rom-elfs\20230320/
Virtual env Python Path (idf.pythonBinPath) C:\work\esp32.espressif\python_env\idf5.3_py3.11_env\Scripts\python.exe
Serial port (idf.port) COM4
OpenOCD Configs (idf.openOcdConfigs) interface/ftdi/esp32_devkitj_v1.cfg,target/esp32s3.cfg
ESP-IDF Tools Path (idf.toolsPath) c:\work\esp32.espressif
Git Path (idf.gitPath) c:\work\esp32.espressif\tools\idf-git\2.39.2\cmd\git.exe
-------------------------------------------------------- Configurations access -------------------------------------------------------------
Access to ESP-ADF Path (idf.espAdfPath) false
Access to ESP-IDF Path (idf.espIdfPath) true
Access to ESP-MDF Path (idf.espMdfPath) false
Access to ESP-Matter Path (idf.espMatterPath) false
Access to ESP-IDF Custom extra paths
Access to c:\work\esp32.espressif\tools\xtensa-esp-elf-gdb\12.1_20231023\xtensa-esp-elf-gdb\bin: true
Access to c:\work\esp32.espressif\tools\riscv32-esp-elf-gdb\12.1_20231023\riscv32-esp-elf-gdb\bin: true
Access to c:\work\esp32.espressif\tools\xtensa-esp-elf\esp-13.2.0_20230928\xtensa-esp-elf\bin: true
Access to c:\work\esp32.espressif\tools\riscv32-esp-elf\esp-13.2.0_20230928\riscv32-esp-elf\bin: true
Access to c:\work\esp32.espressif\tools\esp32ulp-elf\2.35_20220830\esp32ulp-elf\bin: true
Access to c:\work\esp32.espressif\tools\cmake\3.24.0\bin: true
Access to c:\work\esp32.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\bin: true
Access to c:\work\esp32.espressif\tools\ninja\1.11.1: true
Access to c:\work\esp32.espressif\tools\idf-exe\1.0.3: true
Access to c:\work\esp32.espressif\tools\ccache\4.8\ccache-4.8-windows-x86_64: true
Access to c:\work\esp32.espressif\tools\dfu-util\0.11\dfu-util-0.11-win64: true
Access to c:\work\esp32.espressif\tools\esp-rom-elfs\20230320: true
Access to Virtual env Python Path (idf.pythonBinPath) true
Access to CMake in environment PATH undefined
Access to Ninja in environment PATH undefined
Access to ESP-IDF Tools Path (idf.toolsPath) true
-------------------------------------------------------- Configurations has spaces -------------------------------------------------------------
Spaces in system environment Path true
Spaces in ESP-ADF Path (idf.espAdfPath) false
Spaces in ESP-IDF Path (idf.espIdfPath) false
Spaces in ESP-MDF Path (idf.espMdfPath) false
Spaces in ESP-Matter Path (idf.espMatterPath) false
Spaces in ESP-IDF Custom extra paths
Spaces in c:\work\esp32.espressif\tools\xtensa-esp-elf-gdb\12.1_20231023\xtensa-esp-elf-gdb\bin: false
Spaces in c:\work\esp32.espressif\tools\riscv32-esp-elf-gdb\12.1_20231023\riscv32-esp-elf-gdb\bin: false
Spaces in c:\work\esp32.espressif\tools\xtensa-esp-elf\esp-13.2.0_20230928\xtensa-esp-elf\bin: false
Spaces in c:\work\esp32.espressif\tools\riscv32-esp-elf\esp-13.2.0_20230928\riscv32-esp-elf\bin: false
Spaces in c:\work\esp32.espressif\tools\esp32ulp-elf\2.35_20220830\esp32ulp-elf\bin: false
Spaces in c:\work\esp32.espressif\tools\cmake\3.24.0\bin: false
Spaces in c:\work\esp32.espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\bin: false
Spaces in c:\work\esp32.espressif\tools\ninja\1.11.1: false
Spaces in c:\work\esp32.espressif\tools\idf-exe\1.0.3: false
Spaces in c:\work\esp32.espressif\tools\ccache\4.8\ccache-4.8-windows-x86_64: false
Spaces in c:\work\esp32.espressif\tools\dfu-util\0.11\dfu-util-0.11-win64: false
Spaces in c:\work\esp32.espressif\tools\esp-rom-elfs\20230320: false
Spaces in Virtual env Python Path (idf.pythonBinPath) false
Spaces in ESP-IDF Tools Path (idf.toolsPath) false
----------------------------------------------------------- Executables Versions -----------------------------------------------------------
Git version 2.39.2.windows.1
ESP-IDF version 5.3.0
Python version 3.11.3
Python's pip version 23.3.1
-------------------------------------------------- Project configuration settings ----------------------------------------------------------
-------------------------------------------------- Python packages in idf.pythonBinPath ----------------------------------------------------
bitarray version: 2.8.4
bitstring version: 4.1.4
CacheControl version: 0.13.1
certifi version: 2023.11.17
cffi version: 1.16.0
charset-normalizer version: 3.3.2
click version: 8.1.7
colorama version: 0.4.6
construct version: 2.10.69
contextlib2 version: 21.6.0
cryptography version: 41.0.7
ecdsa version: 0.18.0
esp-coredump version: 1.9.0
esp-debug-backend version: 1.0.3
esp-idf-kconfig version: 2.0.1
esp-idf-monitor version: 1.3.4
esp-idf-panic-decoder version: 0.2.0
esp-idf-size version: 1.0.1
esptool version: 4.7.dev3
filelock version: 3.13.1
freertos-gdb version: 1.0.2
idf-component-manager version: 1.4.1
idna version: 3.6
intelhex version: 2.3.0
kconfiglib version: 14.1.0
markdown-it-py version: 3.0.0
mdurl version: 0.1.2
msgpack version: 1.0.7
packaging version: 23.2
pip version: 23.3.1
pyclang version: 0.4.2
pycparser version: 2.21
pyelftools version: 0.30
pygdbmi version: 0.9.0.2
Pygments version: 2.17.2
pyparsing version: 3.1.1
pypiwin32 version: 223
pyserial version: 3.5
pywin32 version: 306
PyYAML version: 6.0.1
reedsolo version: 1.7.0
requests version: 2.31.0
requests-file version: 1.5.1
requests-toolbelt version: 1.0.0
rich version: 13.7.0
schema version: 0.7.5
setuptools version: 69.0.2
six version: 1.16.0
tqdm version: 4.66.1
urllib3 version: 1.26.18
---------------------------------------------------- Check ESP-IDF python requirements.txt -------------------------------------------------
Check ESP-IDF Python packages Python requirements are satisfied.
---------------------------------------------------- Check extension requirements.txt ------------------------------------------------------
Check Extension Python packages Error
---------------------------------------------------- Check ESP-IDF debug adapter requirements.txt ------------------------------------------
Check Debug AdapterPython packages Python requirements are satisfied.
---------------------------------------------------- Visual Studio Code launch.json --------------------------------------------------------
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "ESP-IDF Debug: Launch",
"type": "espidf",
"request": "launch"
}
]
}
---------------------------------------------------- Visual Studio Code c_cpp_properties.json ----------------------------------------------
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "windows-gcc-x86",
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}
----------------------------------------------------------- Latest error -----------------------------------------------------------------
Latest error at Unknown error in ESP-IDF doctor command
Extension
No response
Description
ESP-IDF tools are installed and working properly with idf.py commands, but the extension does not detect them:
Debug Message
Not relevant
Other Steps to Reproduce
I tracked it down to this line: https://github.com/dyarkovoy/vscode-esp-idf-extension/blob/f549deda8116673b1564d0f2e50cd77904344cca/src/idfToolsManager.ts#L207
My process.env
PATH variable has all letters in upper case. For some reason, this line assumes that on Windows PATH variable is "Path", which is not true, at least not on my Windows. Even though process.env
keys are case-insensitive, the actual glitch occurs on this line: https://github.com/dyarkovoy/vscode-esp-idf-extension/blob/f549deda8116673b1564d0f2e50cd77904344cca/src/idfToolsManager.ts#L217
where it attempts to find "Path" variable in the modifiedEnv
, which is a regular object with case-sensitive keys.
The proposed solution is to extract actual PATH
key name from the process.env
using this simple expression:
Object.keys(process.env).find(k=>k.toUpperCase()=="PATH")
, rather than assuming that PATH is always "Path" on Windows.
I tested the proposed solution and it solves this issue. I will submit PR shortly.
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.