No matter what I do, I can’t seem to use anything other than the built-in platformio-core
.
Granted, my situation is more complex than average, so I don’t expect a “one-click” solution, but I need to understand how the vscode extension interacts with pio
to fix this.
So: I’m on NixOS
, which means I cannot just use any downloaded binaries. While the nix
package could theoretically be made to work, we’d still have problems with the respective toolchain binaries, so I figured I’d directly use a container (from Docker).
Starting it like this basically yields a “native workalike”, as if it was installed as my home user:
podman run --name=piocontainer --rm -it -p8008:8008 -e HOME=${HOME} -v ${HOME}:${HOME} -w $(pwd) shaguarger/platformio pio home --host=0.0.0.0 --port=8008
(It’s of course very insecure to mount ${HOME}
entirely into the container, but for now first a PoC, I can always reduce to specific dirs).
So now I can access localhost:8008
with a browser and use all functionality of the web ui.
To actually have the pio
command in my user session, I made a small wrapper:
#!/usr/bin/env bash
PC=piocontainer
if [ "$(podman ps --filter="name=$PC" | wc -l)" -lt 2 ]; then
echo "FATAL: container \"$PC\" not running!"
exit 1
fi
podman exec -t $PC pio "$@"
which I make sure is in the PATH
(also of the vscode
session) and which behaves perfectly fine like a “native” pio
binary. (I.e. I can type all pio <command>
stuff as usual).
My vscode
settings point to the correct host:port and the
{
"platformio-ide.useBuiltinPIOCore": false,
"platformio-ide.useBuiltinPython": false,
"platformio-ide.pioHomeServerHttpHost": "127.0.0.1",
"platformio-ide.pioHomeServerHttpPort": 8008,
"platformio-ide.customPATH": "/home/jeroen/.platformio/bin"
}
where the last path contains the above wrapper script.
So the questions are:
- why this doesn’t work? (Any
pio
buttons I press invscode
lead toLoading...
message and after a while a server timeout error:Error: Could not start PIO Home server: Timeout error at Timeout._onTimeout
) - how is the extension supposed to communicate with
pio
: only via the API (localhost:8008
) or does it also execute the cli? - why does the extension try to install
pio
and try to start “the server”, even though I explicitly told it I’m not using the builtin ("platformio-ide.useBuiltinPIOCore": false
)