VSCode for Gamebuino with IntelliSense

0.2

By bfx, 1 month ago

The Arduino IDE is a good starting point to code with the Gamebuino, but it lacks features that one can expect from a modern development environment:

  • Context-aware syntax highlighting (the highlighting in the Arduino IDE is based on static keywords)
  • Code auto-completion
  • Contextual information on function or structure definition

VSCode is an open source IDE from Microsoft (more or less based on Visual Studio) that provides all these modern features under the name IntelliSense and supports Arduino development. So it is normal to try to use it with the Gamebuino.

There is already a tutorial in french by delay for the basic steps, and a forum post by Crystal Noir regarding the proper configuration of "IntelliSense" (the VSCode set of functions for context-aware features). This is a good basis, but I could not really make IntelliSense work as expected, with unpredictable results. Eventually, by chance, it worked.

So I found the problem deserves more in-depth analysis, and a decent understanding of the "obscure reasons". So here we are! Consider this tutorial as the English version of the other one, with some formalization of the IntelliSense configuration.

Please go to the full tutorial on GitHub.

As soon as the MarkDown editor is available for the Gamebuino pages, I will copy the content of the tutorial here.

Last comments

Steph

NEW 1 month ago

bfx bfx

I've never used multiple .ino files... and I sincerely think I will never code this way ;-)

bfx

NEW 1 month ago

Steph Steph

Thanks for the info!! I will integrate it as soon as possible (once I found a way to correct formatting issues on the web page).

BTW do not trust too much the part with "multiple .ino files", I still have troubles with that, and I will need to adapt the section.

Steph

1 month ago

I've never used multiple .ino files... and I sincerely think I will never code this way ;-)

Steph

NEW 1 month ago

Hi, bfx,

Thank you for this long tutorial full of explanations and advice. You really delved into the subject! I understand some things better now:-)

Here are some tips for macOS (lower-case m!):

Complete reset of the IntelliSense Database

IntelliSense user databases are located in ~/Library/Application Support/Code/User/workspaceStorage:

$ tree -a ~/Library/Application\ Support/Code/User/workspaceStorage
/Users/steph/Library/Application Support/Code/User/workspaceStorage
└── 82a2b96a83f9401ecbc0e7e3f177d858
    ├── ms-vscode.cpptools
    │   ├── .browse.VC.db
    │   ├── .browse.VC.db-shm
    │   └── .browse.VC.db-wal
    ├── state.vscdb
    └── workspace.json

And the local sketch database is actually located in .vscode/ipch:

$ tree -a sketchname
sketchname
├── .vscode
│   ├── arduino.json
│   ├── c_cpp_properties.json
│   ├── ipch
│   │   └── c7e9a5004e7d31e0
│   │       ├── sketch.ipch
│   │       └── mmap_address.bin
│   └── settings.json
└── sketchname.ino

c_cpp_properties.json configuration file

The environment variable that designates the user space is not USERPROFILE, but HOME :

"env": {
        "PACKAGES_PATH":   "${env:HOME}/Library/Arduino15/packages",
        "SKETCHBOOK_PATH": "${env:HOME}/Arduino"
}

... and I guess it must be the same for Linux!


Thanks again for this tutorial which is really very useful!

bfx

1 month ago

Thanks for the info!! I will integrate it as soon as possible (once I found a way to correct formatting issues on the web page).

BTW do not trust too much the part with "multiple .ino files", I still have troubles with that, and I will need to adapt the section.