Quick Suggestions not finding functions

Using rc9 with Editor Quick Suggestions enabled

Starting with with basic sketch

void setup()
{

}

void loop()
{
}


void funcA1()
{
)

void funcA2()
{
)

I would expect that typing funcA into a function definition would cause the "Quick" Suggestion option to find funcA1() and funcA2() but it seems not to

image
What's more, some of the suggested functions are bizarre although I can see why, that by some definition of a match, they are suggested

If the definition of functions funcA1() and funcA2() are moved to the start of the sketch the "Quick" Suggestions finds both functions in the sketch and does not offer the bizarre ones

If function prototypes are added at the start of the sketch then "Quick" Suggestions offers the functions along with the bizarre ones

I have used scare quotes around the work Quick in this post because the suggestions take too long to appear to be useful but I know that this is being tracked elsewhere. What concerns me most is the fact that functions in the same sketch are not found

Further experimentation has revealed another problem

My original tests were carried out with an ESP32 selected as the target board. Suspecting that this may impose an overhead on the time taken to search and find functions I changed the target board to a Nano Classic, only to have this happen
image

It is due to the error in your code. You used a round bracket ()) to close funcA1 instead of the correct curly (}), which makes it so the funcA2 function is not recognized. If you fix the code you will get the expected result:

image

I'm afraid this fuzziness is standard language server behavior, not anything specific to Arduino. For example, here is the same clangd language server used in VS Code in a standard C++ program:

Here you see similar results when using Microsoft's C++ "intellisense" instead of clangd:

I think this fuzzy matching behavior is generally useful to experienced developers (i.e., we want matches even when we made a typo), but might be more confusing to beginners. This is why the "Editor Quick Suggestions" feature is disabled by default. With the "quick suggestions" disabled, you must manually trigger the suggest via the Ctrl+Space keyboard shortcut, so the potentially confusing information is only presented on demand.

It is not clear to me what the other problem is. Please provide more information and I will investigate.

Oh POOH.

I had, of course, not tried compiling the code but thanks for pointing out the error

The other problem was the second line of the suggested functions in my screenshot but I suspect that it was caused by my wrongly constructed code as it is not happening with the code corrected

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.