PlatformIO Community

Too wide hints during writing a code (Arduino C++)

Hi, I’ve started using Visual Studio Code with platformio and generally it’s fine, but one thing is annoying me, maybe anyone of you can help…

My problem is connected to expandable hints during writing a code. E.g., I want to send any output to console, so I write “Serial.” but I’m not sure, what can I use after dot - so, here I have a frame with hints. Great! But, I would expect hints connected to object “Serial”: print, println, write, etc. Why I see here all possible methods from all objects available from my project???

cpp_-Untitled(Workspace)_-_Visual_Studio__2020-01-06_17-35-54

Other example: I can start to type other, non defined (trust me :slight_smile:) object “blablabla.”. And after dot result is the same (as a new user I can’t add more graphics, but trust me again, it is!)

Is possible to set these hints to work more narrow? More sensibly? With hints connected only to object, which I’m writing? As it is working now, it is useless…

Normally it would be…

… but perhaps you’re suffering from a form of IntelliSense not working properly (as I see the ‘problems’ tab on your end shows four ‘problems’…

Thx for answer. Just in case I tried to downgrade my Intellisense extension, didn’t help (4 problems visible in previous screen were connected to lack of #ifndef directives in written code).
But in the meantime I dig this problem a bit and found some clues, which maybe more close shows, what’s going on: when I open .vscode/c_cpp_properties.json in my project (yes, I tried to create new project, result is the same), there is a line: “intelliSenseMode”: “clang-x64”,. And according to help, “clang-x64” is for MAC OS, I’m using windows and here should be msvc-x64! I tried just change this field, but after restart VSC, it was restored to clang again.

Next found clue: Ctrl + Shift + P -> C/C++: Edit configurations (UI):
At first: “patch to compiler” - it is red in my case, with message “path to compiler not found”. It is strange, because I’m able to compile my code, result works well. Output during compiling looks same as Arduino IDE, which I have installed on my PC (written code is for ESP8266, IDE is working with this CPU), so I believe, this compiler is used, but how?
And second: Intellisense mode: here I can set the same msvc-x64/clang-x64, etc. BUT when I’m trying to change this value to proper one, answer is: red box with info: choosen Intellisense mode is incompatible with compiler path.

Hm… can’t tell you what’s going on there… but as a sanity check… here are the relevant configuration bits from my (working) ESP8266 config (on Windows 10)…

"intelliSenseMode": "clang-x64",
"cStandard": "c99",
"cppStandard": "c++11",
"compilerPath": "\"C:/Users/Peter/.platformio/packages/toolchain-xtensa/bin/xtensa-lx106-elf-gcc.exe\" -mlongcalls -mtext-section-literals"

I would suggest that clang-x64 is only the value intelliSenseMode will default to if on MacOS… not necessarily that it is Mac specific… but to be honest, that’s only a guess, on the basis that the Microsoft C++ compiler (i.e. msvc) isn’t the compiler used. If you wanted to test if it makes any difference, try setting it to "intelliSenseMode": "${default}" so that that the intellisense engine makes the determination itself, and then make the .vscode\c_cpp_properties.json read-only so that PlatformIO can’t auto-regenerate it (hint: you can right click on the file in the filebrowser and choose ‘reveal in explorer’ to browse directly to it)… and see what happens after a compile.

Ok… my configuration looks identical. Will try, but in the meantime could you look at your “Edit configurations (UI)” and check what the same fields look in your case? Especially this “path to compiler” is interesting.