Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 68235 - Additional Completion SPI changes
Additional Completion SPI changes
Status: RESOLVED FIXED
Product: editor
Classification: Unclassified
Component: Completion & Templates
5.x
All All
: P4 (vote)
: 6.x
Assigned To: Miloslav Metelka
issues@editor
: API, API_REVIEW_FAST
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-11-07 16:45 UTC by Miloslav Metelka
Modified: 2007-11-05 13:38 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments
Completion SPI diff (22.60 KB, patch)
2005-11-08 14:03 UTC, Miloslav Metelka
Details | Diff
Updated diff (24.16 KB, patch)
2005-11-08 15:50 UTC, Miloslav Metelka
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Miloslav Metelka 2005-11-07 16:45:56 UTC
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.
Comment 1 Miloslav Metelka 2005-11-08 14:03:25 UTC
Created attachment 26706 [details]
Completion SPI diff
Comment 2 Miloslav Metelka 2005-11-08 14:05:33 UTC
As the changes are minor I would like to ask for fasttrack review.
Comment 3 Jan Lahoda 2005-11-08 15:04:11 UTC
Look OK to me.
Comment 4 Jaroslav Tulach 2005-11-08 15:14:31 UTC
"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. 
Comment 5 Petr Pisl 2005-11-08 15:23:04 UTC
I don't have any objections. I hope, that the appropriate changes in jsp editor
will be done.
Comment 6 Miloslav Metelka 2005-11-08 15:48:14 UTC
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.
Comment 7 Miloslav Metelka 2005-11-08 15:50:53 UTC
Created attachment 26713 [details]
Updated diff
Comment 8 Miloslav Metelka 2005-11-08 16:08:17 UTC
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.
Comment 9 Jiri Prox 2006-09-21 12:46:25 UTC
Old target milestone, please reevaluate
Comment 10 Miloslav Metelka 2006-09-25 10:08:20 UTC
I will add the test coverage to the trunk.
Comment 11 Vitezslav Stejskal 2007-01-11 03:10:43 UTC
So, have we got the tests already? Is it still valid? P2?
Comment 12 Vitezslav Stejskal 2007-07-18 13:10:28 UTC
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.
Comment 13 Miloslav Metelka 2007-07-18 13:31:20 UTC
OK. Marking as fixed since the completion spi changes were implemented.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo