While realizing a dual-framework library (Arduino + native ESP-IDF, same source shared between both), I ran into an inconsistency in the PIO Home → Libraries → Examples panel: examples declared with the structured name/base/files format in library.json don’t get grouped or labeled — each file becomes its own entry instead, using the bare filename as the label. So an ESP-IDF-style example (main/main.cpp, main/CMakeLists.txt, CMakeLists.txt, platformio.ini) shows up as four unrelated, oddly-named entries instead of one.
What’s interesting: platform examples (e.g. espressif32’s own examples) don’t have this problem — each platformio.ini correctly anchors one grouped project entry. I dug into the platformio-home source and traced the difference to two separate React containers with different grouping logic (detail-examples-block.jsx for libraries vs. platform-examples.jsx for platforms) — the library one never implements the “group everything under one project” step the platform one does.
Filed a detailed issue with the root cause and a suggested fix here:
Also suggesting, while at it, extending the “Import Project” button (already available for platform examples with a platformio.ini) to library examples that ship one too — useful for libraries where an example is a self-contained, ready-to-build project rather than a single source file.
Curious if others have run into the same thing, or if there’s context on why the two code paths diverged. Happy to help test a fix if it moves forward.
Good investigation. The distinction between the library and platform example handling explains the behavior quite well.
The examples[].name field should reasonably be expected to define the project-level entry, especially when base and files describe a multi-file example. Flattening those files into separate entries makes structured library examples considerably less useful.
Supporting platformio.ini as an importable project would also make sense. It would bring library examples closer to the behavior users already get with platform examples.
Hopefully the maintainers can reuse the grouping logic from platform-examples.jsx rather than maintaining two different behaviors.