0

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;
 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?

Daniel Daranas
  • 22,454
  • 9
  • 63
  • 116
4ntoine
  • 19,816
  • 21
  • 96
  • 220
  • "*users frequently type chars one-by-one and don't want to close function first and then return back to variable*" Dunno which editor you're using, but mine (kate) automatically inserts a closing brace/parenthesis/bracket/whatever whenever I type the opening one. Granted that doesn't answer your question, but you might be able to configure your editor this way and work around the problem altogether. – syam Dec 14 '13 at 05:19
  • that can be probably walk-around, but i assume there can be another cases like missing `;` or missing `return` just because return is after typed text or smth and Clang should be smart enough to apply fix just-in-time for code complete. otherwise it's for perfect users but not for real. – 4ntoine Dec 14 '13 at 05:27

0 Answers0