wild mustang
wild mustang

Reputation: 68

Variable Code Completion in Netbeans without Ctrl+Space

Is it possible to enable auto code completion for variables in Netbeans? I see a similar question here, but it doesn't work on variables (correct me if I'm wrong).

This is my current code completion setting: a screenshot

Upvotes: 1

Views: 1296

Answers (1)

skomisa
skomisa

Reputation: 17343

This worked for me:

  • In NetBeans select Tools -> Options -> Editor -> Code Completion tab -> Language: C/C++
  • As given in this SO answer, set the content of the Auto Popup Triggers... field to contain the following string:

.;->;.;->;::;new ; ;a;b;c;d;e;f;g;h;i;j;k;l;m;n;o;p;q;r;s;t;u;v;w;x;y;z;

  • Click the Apply button, then click OK.

Here's a screenshot:

OptionsScreen

The change should be immediately effective. After doing that you can type the first letter of any variable in your C++ source code and eligible variables should be listed in the prompt which automatically appears.

The screen shot below is a contrived example where there are several variables starting with 's'. All I did was type the letter 's' and the prompt appeared instantly, listing all of the local and global variables starting with 's':

CodeCompletionPrompt

Upvotes: 3

Related Questions