Clang code complete walk-around?


I’m working on adding code complete via Clang to text editor to make it IDE.

The source code:

"struct s {
int a;
float b;

void main() {
s var;

the problem is that code complete for the position after dot returns nothing and if i add “}” at the end and retry code complete for the position after dot it shows the correct list.

I understand that the main function definition should be closed, but users frequently type chars one-by-one and don’t want to close function first and then return back to variable and then get code complete. How can that be walked-around to avoid go back/return?

My idea was to get diagnostics and add “}” if i get according diagnostics, but it’s unwished walk-around. Can Clang be smart enough to make it itself?

Thanks and regards,