Autocompletion is extremely unstable

I'm using Arduino IDE 2.2.1 on Windows 11 and is liking the general improvement over 1.x!

My main problem, however (apart from the very difficult to change preference of using spaces as indentation, but that's a separate discussion) is that the autocompletion (code completion, quick suggestions) feature seems horribly unstable. This seems to be especially true for larger projects, with multiple files (yes, people, multiple files are good to use!).
Rather often when coding, the code suggestions suddenly stops working for no apparent reason. It usually starts working again after I restart that Arduino instance, but not always. The only mention of this that I've found is a bug in 2.1 where it wouldn't work unless files were stored in C:, which my files were. I also found mentioning of some targets not working at all (in 2.0), which is not really the same problem I have.

After quite a bit of experimentation, I have found a couple of things that impacts this:

  1. Larger projects (as mentioned) often triggers this.
  2. Naming files *.c is apparently really bad. I typically name new files *.c, because I tend to code in pure C as much as I can (because I don't know C++ very well). Autocompletion sometimes works in files name *.c, but not very often. Renaming the files to *.cpp improves a lot!
  3. Sometimes, only part of the file doesn't work. It works when writing in one function, but not in another. Or above/below certain lines. This might be due to code errors, but I'm sure. It's difficult to reproduce.

Edit: I realized you can use the command "Restart language server" (ctrl+shift+p, then Restart language server) to achieve about the same effect as restarting Arduino.

Sadly, as mentioned, this problem is very difficult to reproduce. I did see an improvement in 2.2.1 from the last one I used (2.1.x, I think, don't remember). The only way to reproduce it is to rename files *.c, which probably isn't great for other reasons.

Not solving the issue.

You can happily call them .cpp and write plain C code in them. I'm still doing that mostly.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.