This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
There are three issues that require minor Completion SPI changes: 1) Extend semantics of CompletionTask.refresh(CompletionResultSet resultSet) to allow to be called with null parameter before the Completion.query() gets called. The following method needs to be added into AsyncCompletionQuery: protected void preQueryUpdate(JTextComponent component) { return null; } This allows to cancel the completion computation in case an "invalid" (e.g. non-identifier) character gets typed. It will allow us to fix issue 64792 and similar issues. This is semantically incompatible change (but binary compatible). The updating of the existing implementations should be minimal as practically of them use AsyncCompletionQuery. 2) Add method for customization of the "Please wait..." message being show when the completion results do not get computed in a certain amount of time. The following method needs to be added into CompletionResultSet final class: public void setWaitText(String waitText) { ... } After this change the following issue can be resolved: issue 59661 - Code Completion should show Scanning in progress This is binary compatible change. 3) Add method for getting of the prefix of the completion item that would be inserted by pressing Enter key e.g. the field name for fields or a method name for methods (but not parameters) or a non-FQN name for classes. It will allow to insert longest common prefix of all the completion items once TAB key gets pressed when the completion is open (or auto-insert the common prefix upon explicit completion showing). The following method needs to be added into CompletionItem interface: CharSequence getInsertPrefix(); We will then be able to fix the following issue: issue 67505 - TAB doesn't work in code completion like it used to We believe that the changes are minor and so it's better to submit them and track them as a single request. I will attach a complete diff into the issue.
Created attachment 26706 [details] Completion SPI diff
As the changes are minor I would like to ask for fasttrack review.
Look OK to me.
"summary>Editor Code Completion API created</summary>" is probably wrong. Maybe you want three different apichanges as the changes are independent. I do not understand the meaning of the first change as that modifies something in a call-flow which is not described anywhere. I believe that (especially because it is asynchronous) it should have a test coverage. To verify the behaviour and also show the intended call-flow.
I don't have any objections. I hope, that the appropriate changes in jsp editor will be done.
Thanks to all for reviewing and comments. I have fixed the apichanges name and I've made three apichanges so the final version is 1.5. I will integrate the change but I'll leave the issue opened until we finish the tests.
Created attachment 26713 [details] Updated diff
Fixed in trunk: Checking in editor/codetemplates/src/org/netbeans/lib/editor/codetemplates/CodeTemplateCompletionItem.java; /cvs/editor/codetemplates/src/org/netbeans/lib/editor/codetemplates/CodeTemplateCompletionItem.java,v <-- CodeTemplateCompletionItem.java new revision: 1.11; previous revision: 1.10 done Checking in editor/completion/apichanges.xml; /cvs/editor/completion/apichanges.xml,v <-- apichanges.xml new revision: 1.2; previous revision: 1.1 done Checking in editor/completion/manifest.mf; /cvs/editor/completion/manifest.mf,v <-- manifest.mf new revision: 1.4; previous revision: 1.3 done Checking in editor/completion/src/org/netbeans/modules/editor/completion/CompletionImpl.java; /cvs/editor/completion/src/org/netbeans/modules/editor/completion/CompletionImpl.java,v <-- CompletionImpl.java new revision: 1.26; previous revision: 1.25 done Checking in editor/completion/src/org/netbeans/modules/editor/completion/CompletionResultSetImpl.java; /cvs/editor/completion/src/org/netbeans/modules/editor/completion/CompletionResultSetImpl.java,v <-- CompletionResultSetImpl.java new revision: 1.5; previous revision: 1.4 done Checking in editor/completion/src/org/netbeans/spi/editor/completion/CompletionItem.java; /cvs/editor/completion/src/org/netbeans/spi/editor/completion/CompletionItem.java,v <-- CompletionItem.java new revision: 1.4; previous revision: 1.3 done Checking in editor/completion/src/org/netbeans/spi/editor/completion/CompletionResultSet.java; /cvs/editor/completion/src/org/netbeans/spi/editor/completion/CompletionResultSet.java,v <-- CompletionResultSet.java new revision: 1.4; previous revision: 1.3 done Checking in editor/completion/src/org/netbeans/spi/editor/completion/CompletionTask.java; /cvs/editor/completion/src/org/netbeans/spi/editor/completion/CompletionTask.java,v <-- CompletionTask.java new revision: 1.5; previous revision: 1.4 done Checking in editor/completion/src/org/netbeans/spi/editor/completion/support/AsyncCompletionQuery.java; /cvs/editor/completion/src/org/netbeans/spi/editor/completion/support/AsyncCompletionQuery.java,v <-- AsyncCompletionQuery.java new revision: 1.4; previous revision: 1.3 done Checking in editor/completion/src/org/netbeans/spi/editor/completion/support/AsyncCompletionTask.java; /cvs/editor/completion/src/org/netbeans/spi/editor/completion/support/AsyncCompletionTask.java,v <-- AsyncCompletionTask.java new revision: 1.4; previous revision: 1.3 done Checking in java/editor/src/org/netbeans/modules/editor/java/ElementCreatingCompletionProvider.java; /cvs/java/editor/src/org/netbeans/modules/editor/java/ElementCreatingCompletionProvider.java,v <-- ElementCreatingCompletionProvider.java new revision: 1.7; previous revision: 1.6 done Checking in java/editor/src/org/netbeans/modules/editor/java/JavaCompletionProvider.java; /cvs/java/editor/src/org/netbeans/modules/editor/java/JavaCompletionProvider.java,v <-- JavaCompletionProvider.java new revision: 1.13; previous revision: 1.12 done Checking in java/editor/src/org/netbeans/modules/editor/java/NbJMIResultItem.java; /cvs/java/editor/src/org/netbeans/modules/editor/java/NbJMIResultItem.java,v <-- NbJMIResultItem.java new revision: 1.35; previous revision: 1.34 done Checking in html/editor/lib/src/org/netbeans/editor/ext/html/HTMLCompletionQuery.java; /cvs/html/editor/lib/src/org/netbeans/editor/ext/html/HTMLCompletionQuery.java,v <-- HTMLCompletionQuery.java new revision: 1.24; previous revision: 1.23 done Checking in web/jspsyntax/src/org/netbeans/modules/web/core/syntax/completion/JspCompletionItem.java; /cvs/web/jspsyntax/src/org/netbeans/modules/web/core/syntax/completion/JspCompletionItem.java,v <-- JspCompletionItem.java new revision: 1.10; previous revision: 1.9 I will continue to work on the tests.
Old target milestone, please reevaluate
I will add the test coverage to the trunk.
So, have we got the tests already? Is it still valid? P2?
I think we should close this one. It's about missing tests. The change has already been in trunk for ages. Milo, if you have the tests ready, please check them in. If not, never mind and close it. Adding more tests is a continuous effort anyway.
OK. Marking as fixed since the completion spi changes were implemented.