Skip to content

Developing with VSCode

luni64 edited this page Jul 2, 2021 · 6 revisions

vsCode together with its c/c++ extension has a ton of useful features which might not be known by those switching from the Arduino IDE. The following writeup shows how to use some of those productivity enhancers.

Hover to get useful information on the fly

vsCode displays a lot of useful information if you simply hover over various parts of your source code. E.g. it can display the value of constants and defines, it shows the signature of functions and the type of variables. If intellisense found an error or a warning (squiggles under the symbol), hovering over the squiggles shows the corresponding error or warning message.

hovering

Use F12 to find the definition of functions and other symbols

Sometimes you want to have a look at the definition or declaration of a symbol. In vsCode you can simply press F12 to open a new editor tab which contains the source file with the searched symbol. No need for grep or other text search tools. Please note that F12 will always find the correct (used) definition, even if the searched symbol is used in a lot of places. It also finds the right one if there are multiple definitions selected by #defines etc.

As an example, the following clip shows how to find the definition of the analogWrite() function and how to further drill down to analogWriteDAC0() by using F12 again.

image

Code completion

tbd

Error wiggles

tbd

The issues tab

tbd