PlatformIO Community

Autocomplete in 32bitUbuntu and VS_Code

Trying to set up an old 32 bit Celeron with Ubuntu to use on my bench. VS Code and PlatformIO work well on my Win 10 machines, but autocomplete provides bad suggestions on the Ubuntu machine. (Yes, I know that PlatformIO is leaving 32 bit Linux, but I’d like to use it at least for a while.) I installed Clang-Format for VSC.

I don’t understand a lot in the things I’ve read about the problem. Can someone who understands this give me grace and help me out?

Can you provide the outut of pio system info (in CLI), the platformio.ini if your project, the list of VSCode extensions and a screenshot of those bad IntelliSense suggestions?

Thanks for your reply!
Update: Autocomplete worked briefly this morning, but hasn’t worked since I closed and reopened VS Code. Here’s a screenshot that shows the enabled extensions, pio system information and the bad suggestions. I don’t know what’s up with the squiggles under the #include. This code compiled, loaded and ran.
image
I first tried to use the Clang-Format extension loaded from within VSC. Then I saw some other instructions that showed how to load Clang from the Linux terminal. I currently have the Clang_Format path set to: /usr/bin/…/lib/gcc/i686-linux-gnu/7.5.0

Here’s the Platformio.ini: ; PlatformIO Project Configuration File

[env:uno]

platform = atmelavr

board = uno

framework = arduino

I think I’m probably close, but so far, I haven’t been able to make it work. I appreciate any instructions you can provide.

Please remove all extensions except C/C++ by Microsoft and PlatformIO IDE. No other but these two should be handling the C++ autocomplete.

Then execute the project task “Miscelleneous -> Rebuild IntelliSense Index”.

Thank you. I removed all extensions but the two you mentioned. When I did, PIO didn’t launch. It worked again after I added Python. I then executed the Rebuild IntelliSense Index, but no joy. Now I’m seeing a couple of errors when I launch: /home/pdschroder/Pictures/Screenshot from 2021-01-10 09-40-01.png The file that won’t parse is c_cpp_properties.json. And I’m not sure which file to configure or how to fix it. Again it seems strange that it worked right for just a moment, but that I haven’t been able to get back to that state again.

I’ll check in a VM with the Ubuntu 16.04.06 i386 iso image (I presume that’s what you’re using here – Ubuntu 18 32-bit version is non-existant on the website, but Lubuntu 18.04.05 exists, but that’s not Lubuntu in the screneshot).

Screenshot from 2021-01-10 09-40-01
(I must have done something wrong when I tried to insert the screenshot last time.

I’m using Ubuntu 18.04 LTS 32 bit. It’s slow starting, but after it’s running it does OK. It seems to handle PIO well enough, it’s just that I can’t get autocomplete to work, and that’s frustrating. Thanks for your kind help.

Okay yeah all installed in a VM and I’m beginning to run into the same problems.

grafik

Visual Studio Code has dropped support for Intel 32-bit platforms since also Node.js has dropped it (https://github.com/microsoft/vscode-remote-release/issues/67#issuecomment-489553810). This forced me to install the last supported version, VSCode 1.35, from May 2019, from https://code.visualstudio.com/updates/v1_35. This old version parses JSON files differently than the newer versions (comments in JSON are allowed in recent versions). Thus the C/C++ extension fails to load its config files and the intellisense is just… bad, incomplete, wrong or all.

Installing the extension and PlatformIO core using the installer script went through, but after creating a project, that old VSCode version has a problem with the // comments in the .vscode/c_cpp_properties.json file that PlatformIO generates.

However, that can be fixed in the template that generates that file.

max@ubuntu:~$ find . -name "c_cpp_properties.json.tpl" 
./.platformio/penv/lib/python3.6/site-packages/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl

Editing that file and removing the

//
// !!! WARNING !!! AUTO-GENERATED FILE!
// PLEASE DO NOT MODIFY IT AND USE "platformio.ini":
// https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags
//

plus a Project task -> Rebuild IntelliSense later and…

grafik

the IntelliSense is back.

Compiling and uploading works fine, too, for an Arduino Uno at least.

Note though that you’re also stuck on an older PlatformIO extension version, 1.10.0, as opposed to 2.2.1, probably because it detects that it needs a newer VSCode version. So there are tons of improvements and bugfixes that you can’t experience in the VSCode GUI. Maybe with some hacks like using an unofficial node build, paired with compiling Visual Studio Code yourself, that can be fixed, but that’s beyond me. This seems to be as good and as painless as it gets for now.

But, you can run the latest PlatformIO core version (5.x), and that’s also good and important. So using it from the CLI is completely as if you were running it on a modern x64 CPU with the latest version.

As a personal opinion, for an older 32-bit PC/Laptop I’d suggest using Xubuntu (XFCE desktop), Lubuntu (LXDE desktop) or Bionic Pup, since those are less graphics, memory and CPU intensive than Ubuntu Mainline with its Unity desktop in that version. Also see the new video from Explaining Computers at https://www.youtube.com/watch?v=aJcWcQ8ew6Q :slight_smile:

That’s all it took!! Thank you very much for your kind assistance. I need to figure out how to learn what you know.

Thanks too for your suggestions about Xubuntu and Lubuntu. I had considered going to one of those, but now that I have VS Code and Platformio working, I think I’m going to leave well enough alone until I spring for a better computer. I do most of my work on my Win10 tower, but wanted to have something back at my bench. I think this will serve very well for now.