Domanda

I'm working with netbeans code templates, using it to parse information from a file and generate a drop-down menu of code completion options from this. I have been following this tutorial: http://platform.netbeans.org/tutorials/nbm-code-completion.html

I've been able to mostly get it working, except for one problem. When hitting "Ctrl+Space" a second time (or first time when I have the drop-down box automatically appear without command), it gives me a message of "No suggestions".

For example, I have a few functions called GET_ATTRIBUTES. Therefore, if I type "GET_A" and press Ctrl+Space, it gives a list of the functions available. However, if I press Ctrl+Space a second time, it replaces the dropdown menu with "No suggestions."

Any thoughts on how to fix this?

È stato utile?

Soluzione

Found the problem... the tutorial had us put the following in the code:

if (queryType != CompletionProvider.COMPLETION_QUERY_TYPE)
return null;

which forced it to return nothing after the first request. Commenting that out takes care of it, and lets the drop-down work as desired. Still trying to figure out why exactly that code was in the tutorial... He has an explanation for it, but I don't see how it's very useful most of the time.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top