For beginners it would be a huge help to easily access the documentation for a function or a variable by hovering the mouse over in the IDE 2.0.
Something like the other IDE does. When you move the mouse over a line of code, it gives a short description of it, lists all its parameters or functions and gives a description for them, shows a few examples of its use and finally gives a link where you can learn more about it. Essentially, I would display the Arduino Reference.
I don't know how to implement this in an easily maintainable way, but it would be very useful.
Yes! I've already seen that they started developing it, but if I was right, it doesn't support doxygen or similar documentation from source code comment styles yet or something more advanced solution to store the documentation separately from the code.
The first step is perfect. I would like to suggest to follow this path.
It does support documentation comments. Here is a simple example:
void setup() {
foo(42);
}
void loop() {}
/*
Here is some documentation for the `foo` function.
And another line of documentation here.
*/
void foo(int bar) {}
Hovering the foo call produces this:
The comment above the object is always used, regardless of how much whitespace separates it from the declaration.
Both // and /**/ comments are recognized.
As for whether it has Doxygen markup support, the answer is no. This is not a limitation of Arduino IDE, but rather the standard language server tools Arduino IDE uses. You will get the same results when using these tools in another development environment such as VS Code with C++ files.
I have not been able to find any formal documentation of the markup support it does have, but I can share what I know:
The only markup I have found to be recognized is backtick wrapped `inline code` (see how the reference to foo from documentation comment was rendered in the screenshot I shared) . Even code fences aren't working.
In some cases, line breaks in comments are ignored, in other cases they are preserved. Leave a blank line to force the line break.
See: llvm/llvm-project@b194e7d
Even if this doesn't allow for fancy formatting, I think the existing capabilities are sufficient to significantly enhance the user experience. The real work is simply for the authors of the code to add and maintain these documentation comments. Unfortunately they are quite rare both in Arduino's official codebases as well as those of the community.