arduino-pro-ide alpha 0.0.6

I’ve started using the “pro-ide” and encountered some problems (which is not a surprise = alpha)
This is an EXCELLENT piece of software, clear, efficient… The best idea since the arduino itself !

I have a problem with forward declarations.

CASE A : your function() is above the function LOOP() so you don’t need any declaration because your function() is before the code where you call it. This works OK.

CASE B : If you have plenty of or lengthy functions, you rather place them at the end of the code (that is after the main section (setup() and loop() ) so you can reach quickly the main section. This is convenient but all declarative languages need a so called forward declaration of these functions in order to know about at compile time.
The arduino IDE takes care of that and you get no error when omitting these forward declarations. This works OK with both IDE (standard and Pro)
BUT the pro IDE underlines (red wave) all calls to these functions because C needs a forward declaration. The compilation works OK without errors. But reading the code is very messy to read. So let’s try the next case.

CASE C : In order to prevent the problems seen in case A and B you just need to add these forward declaration before any call to these functions. This works OK, no error, no red waves, compiles as well.


There is a very useful feature : on the right of the proIDE you can open a panel called ‘OUTLINE’ you can toggle it using the icon under the blue ones on the top right.
This panel contains all identifiers used in you code, and when you click one, you jump directly to it… and this is great !
BUT when you have forward declarations you jump to it and not to the function() itself which is a real pain…

SUGGESTION : keep the forward declaration principle because that is the right way to think in a declarative language, but get the feature ‘OUTLINE’ to jump to the function() and not to forward declaration.

Thanks !

@lamidou has submitted a bug report for this issue on GitHub:

Although I see you're not a fan of the automatic function prototype generation (AKA forward declaration) feature of the Arduino development software, you're stuck with it (though you're welcome to not use it). Getting rid of this feature would break a huge number of existing sketches and tutorials. So I think the more important issue you've exposed is that the Pro IDE's "language server" doesn't know about the function prototype generation system. To fix this, I think the Pro IDE would need to run the Arduino sketch preprocessor on every change to the code and then feed the preprocessed code to the language server.

Regarding the issue of the outline jumping to the declaration, I notice that the right click menu in the code editor has a "Go to declaration" and a "Go to definition" option, so the capability you want already exists. I'm a bit surprised the outline doesn't have the same right click menu options. I do notice that the "Go to declaration" option doesn't work, but the "Go to definition" does.