VSCode PlatformIO and the dreaded "IntelliSense Index Rebuild"

So, in getting some projects working under both windows and Linux development environments on multiple machines, I’ve been hitting the “PlatformIO: IntelliSense Index Rebuild” (can’t remember if that is the exact phrasing from the status bar) a few times… and I finally twigged as to what was happening (in my case, anyway)… When I cloned a repo that needed a complete new platform and library setup… platformio was surreptitiously starting to downloading all the pre-requisites so that when I hit that ‘Build’ button everything would be ready to go. However, since my internet is quite slow when trying to get some of the packages (i.e. the xtensa compiler/SDK for the esp8266)… it takes a while… and intellisense just sits there seemingly frozen.

Now that I’ve given the background… the purpose of this post is to ask - is there some way to get access to status of what is happening at the time (other than randomly trawling task manager, realising platformio and VScode is busy using the network/internet, and then seeing the temp files downloading in the platformio folder and unpacked :wink: ). I did close VSCode, and managed to get a build going before intellisense tried to update, allowing the build to start, and consequently was able see status messages for libraries and platform stuff being downloaded unpacked… but it is pretty hit and miss… so hopefully there is a better way?

Thanks! You described everything very well. We need a real toolchain and related frameworks to build configuration for IntelliSense service. If you use PIO Home -> Create Project, it will show progress.
It seems that you opened PlatformIO project on a clean machine.

Nevertheless, we don’t download something “twice”. PlatformIO Package Manager locks the main DB and other processes wait when it will finish.

In any case, we will think about how to improve this issue.

2 Likes

Yeah, I was importing projects from another machine via git on a clean install of PlatformIO, so it had the disadvantage of having to download the platform support files, which held things up for a while.

Can’t really say I noticed progress when doing it through ‘Create Project’… just that animated messages about PlatformIO - indicating that things probably hadn’t frozen.

That’s why I was hoping maybe there was a hidden console window or something in VScode where you could see the package manager status, just as you would see it if you were building and dependencies were missing. It would at least be a stopgap until things could be improved on that front.

Hit this problem today too. Yes, it happened after I moved the project to a new machine.
The workaround described in the closed issue (VSCode: PlatformIO IntelliSense Index Rebuild task runs forever · Issue #68 · platformio/platformio-vscode-ide · GitHub) (namely, disabling Internet access temporarily so that Platformio stops rebuilding Intellsense index, then enabling it and building the project) works.

1 Like

Yes, this is what I have seen when switching between linux/windows and different frameworks, etc… either wait out the 'IntelliSense Index rebuild… which is actually downloading the necessary framework files… or if you can beat it, do a build… as then at least you get progress whilst it’s downloading/installing. Otherwise, yeah, disabling your networking until you manually run the build would certainly make it behave! :wink:

It’s something that will hopefully be worked on in the future… it’s not locked up (usually)… it’s just that since there’s no progress messages… you don’t know what is actually happening.

1 Like

It was unexpected for me that a background process like Intellisense index rebuild can install packages. I thought only Build or Upgrade commands would do it.
Perhaps index rebuilding should be made foreground operation with its own terminal? Either that or make it fail if something’s not installed.

1 Like

Yeah, just having it’s own terminal would be enough… then at least you could see what it’s doing, and possibly abort if you don’t want it download stuff at that point in time. As Ivan pointed out above… for IntelliSense to function, you need

a real toolchain and related frameworks to build configuration for IntelliSense service.

So if you don’t have it installed, either because you haven’t used that framework before on the machine in question, or because you uninstalled it for some reason… it’s gunna get downloaded during the IntelliSense rebuild in order for it to actually function. But yeah, some way of knowing what it’s doing would be nice :wink: You’ll often see a rebuild when you edit your platformio.ini… and if you add a new lib_dep… you’ll spot it downloading the library during that scan.