Why do I need to disable and re-enable platformIO extension *every time* I reload VS Code before PIO works?

Why do I need to disable and re-enable platformIO extension every time I reload VS Code before PIO works?

This issue has been bugging me for months and has no end in sight. I see a tons of other reports of the same “command 'platformio-ide.*' not found” on GH with no clear resolutions.

I’ve looked at all the places logs are generated (Developer Tools, Extension Logs) and not seen anything of relevance.

It looks like the PlatformIO extension isn’t even getting loaded by VS Code.

This made me think it might have been my settings, specifically the “activateOnlyOnPlatformIOProject”:

{
  "platformio-ide.autoOpenPlatformIOIniFile": false,
  "platformio-ide.activateOnlyOnPlatformIOProject": true,
  "platformio-ide.disablePIOHomeStartup": true
}

But trying other options for these settings doesn’t fix anything.

I’d be more than happy to poke a this problem more but I have no idea where else to start.

Try filing a bug for the developers at Issues · platformio/platformio-vscode-ide · GitHub with the exact reproduction sequence, they should help you there.

They exist. I’ve posted to this issue there and gotten nothing. I’ve seen this issue many other times without real resolution (usually the bot just comes in, marks it stale, and closes it).

I have no idea how my system got here. I don’t know how to reproduce except this happens on multiple of my systems.

I’m more than willing to debug this and have tried all the avenues that have been suggested to no avail. That’s why I’m here, hoping someone will notice this issue. This has happened on previous machines of mine as well.

Does this happen on a clean set of VSCode extensions too, with only C/C++ by Microsoft and PlatformIO installed, and in a workspace with only one project?

Ah ha! Good call on disabling other extensions.

It seems that the github.copilot extension is causing this issue for me. Curiously, I’m pretty sure I’ve had this issue before I installed Copilot but, in hindsight, it seems this reliably started happening around the time I started using Copilot.

I’m rather liking Copilot so I don’t want to disable it. Now to figure out what about their startups interact with each other…

I’m not seeing anything obvious in the logs.

Copilot extension seems to be loaded after PlatformIO according to the Extension Host Log.

Then I noticed that Copilot was adding ~200ms to startup time. So I disabled a different extension that was adding ~800ms to the startup time (Live Share) and the problem with PIO went away.

Therefore, it looks to me like the issue is some race condition on extension startup. Like if other extensions take longer than PIO does to start, the PIO extension has issues.

I think that insight information is good enough so that the devs can take a look at this if you open an issue in the above repo, good work.