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.

Bug 60362 - Missing code completion for constructors
Summary: Missing code completion for constructors
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Completion & Templates (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker with 1 vote (vote)
Assignee: Dusan Balek
URL:
Keywords: REGRESSION
: 60807 61884 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-22 08:17 UTC by Jaromir Uhrik
Modified: 2007-11-05 13:38 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot attached... (47.71 KB, image/png)
2005-06-22 08:18 UTC, Jaromir Uhrik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jaromir Uhrik 2005-06-22 08:17:07 UTC
[dev build #200506211800; jdk1.4.2 and 1.5]
Code completion used to show constructor list when the object name with left
round bracket was typed. Now the code completion shows list of some methods and
packages - see attached screenshot.
Comment 1 Jaromir Uhrik 2005-06-22 08:18:20 UTC
Created attachment 22836 [details]
Screenshot attached...
Comment 2 Martin Roskanin 2005-07-12 14:18:28 UTC
*** Issue 60807 has been marked as a duplicate of this issue. ***
Comment 3 Martin Roskanin 2005-07-12 14:21:10 UTC
We should fix it to NB 4.2
Comment 4 Martin Roskanin 2005-07-13 09:35:00 UTC
It is designed behaviour. (Alt+P is dedicated for parameters - but it doesn't
support javadoc pane - issue #60807)

Anyway, it needs to be discussed yet, leaving as open...
Problematic code: (commenting pushExp... should solve the problem of this issue)
http://java.netbeans.org/source/browse/java/editor/lib/src/org/netbeans/editor/ext/java/JCTokenProcessor.java?r1=1.5&r2=1.6
Comment 5 Roman Strobl 2005-07-13 10:39:47 UTC
This issue was opened on nbusers as well. Pasting suggestions from users:

-----------------%<-----------------
I think we're going about this all wrong. I think we're trying too hard to
emulate other IDEs and there is a cleaner approach. Here is my proposal:

1) User types new Font(<ctrl-space>
2) Code-complete brings up a list of possible constructors
3) User chooses one
4) IDE now shows code-complete containing all visible variables (which is what
today's code does) so the user can fill in the constructor arguments.
5) Now, here is the kicker... in step #4, the user is able to see the ALT-P view
on top of the code complete window. That is, he sees a small tooltip with the
constructor he has chosen, its arguments and the current argument he is on
(bolded). Below it, he sees a code-complete window with possible
variables/fields that can be used for the current argument.
6) If the user changes their mind and they want an alternate constructor, they
move the cursor back to "new Font(" and hit code-complete again. Hitting
code-complete right after the braces will always allow you to choose from the
list of available constructors.

    I don't think users should have to alternate between ALT-P and CTRL-SPACE.
Code complete is code complete. We just need to make the current implementation
more context-aware. Sorta like I should be able to invoke "Tools | Synchronize"
inside an anonymous class and it should be smart enough to know that I am
refering to the anonymous class, not to the outer class (as it current does).

    What do you think?
-----------------%<-----------------
Comment 6 Roman Strobl 2005-07-13 10:46:47 UTC
See also relevant issue 51669 which is about automatic filling in of parameters
in methods.
Comment 7 Max Sauer 2005-08-01 15:14:19 UTC
I think this is not behaving correctly also. It is very difficult for a user to
get Javadoc for a constructor.
ie,

Font fn = new Font(|);
won't produce any javadoc upon Ctrl+Shift+Space (you'll get 'Javadoc not found'
info), you can only get the list of parametrs via Atl+P.

Font fn = new Font("aa", 0, 1|1);
Ctrl+Shift+Space won't produce anything.

On the other hand, this:
Font fn = new Font|("aa", 0, 11);
produces proper JavaDoc for the constructor.

[050801 build from cvs]
Comment 8 Roman Strobl 2005-08-18 08:33:53 UTC
Reopened on nbusers:

-------------------%<---------------------
I'm testing new geatures in nb42 and have this situation:

FileInputStream fis = new FileInputStream(|);

When I press CTRL-SPACE Code Completition is show (see images). In 4.1 I now
what constructors have FileInputStream, but in 4.2 I have no idea. My question
is - How can I see constructors in 4.2? 
-------------------%<---------------------

We need to fix this, because the issue removes very useful functionality from
code completion a lot of people are used to. It was raised by several other QE
people as well. Thanks!
Comment 9 Jiri Kovalsky 2005-08-18 08:46:52 UTC
Discoverability of this feature (ALT+P) is in my opinion very poor. Would it be
possible to auto popup the parameters window by default without necessity to
press the shortcut ? To be honest I rather prefer the old way anyway ...
Comment 10 ekolis 2005-08-27 01:48:50 UTC
In addition, even after pressing Alt-P, the code completion isn't as good as
before - it used to give the full javadoc for the constructors; now it only
lists them.
Comment 11 Roman Strobl 2005-08-27 06:44:46 UTC
I've seen the usability study yesterday, nobody found the Alt-P shortuct. People
were complaining that they would like to see javadoc for constructors, but it's
not possible. They were trying to press Alt-space to get it. We should address
this soon, because it can mean UI changes.
Comment 12 _ tboudreau 2005-08-29 09:26:02 UTC
Note also, completion does not show the correct parameters - i.e., type new Str[ctrl-space], and the 
completion you get is

String(java.lang)

whatever that means.  I often invoke it on some class because I forgot the order of constructor 
parameters;  this doesn't help.
Comment 13 Miloslav Metelka 2005-08-29 17:10:14 UTC
Thanks for the feedback.
We propose to modify the present CC behavior and insert the constructors'
completion items into the completion result list in case the caret is after '('
or ',' in the constructor "new XXX(" call. The present parameter's tooltip would
not be shown by default (it could still be shown explicitly by Alt-P) and the
completion's window would remain open after the opening '(' in the constructor's
call. The constuctor's parameter being typed would be shown in bold.
The methods would work in a similar way.
The completion items should be distinguishable from the rest of the items (Jano
R. is working on that from the UI point of view).

This should cover both the missing possibility of showing of the constructors'
javadocs and decrease the importance if the user does not discover the Alt-P
shortcut.
Comment 14 Miloslav Metelka 2005-08-31 17:34:35 UTC
Fixed in trunk:
Checking in lib/src/org/netbeans/editor/ext/java/JCTokenProcessor.java;
/cvs/java/editor/lib/src/org/netbeans/editor/ext/java/JCTokenProcessor.java,v 
<--  JCTokenProcessor.java
new revision: 1.7; previous revision: 1.6
done
Checking in lib/src/org/netbeans/editor/ext/java/JavaCompletionQuery.java;
/cvs/java/editor/lib/src/org/netbeans/editor/ext/java/JavaCompletionQuery.java,v
 <--  JavaCompletionQuery.java
new revision: 1.5; previous revision: 1.4
done
Checking in 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.6; previous revision: 1.5
done
Checking in src/org/netbeans/modules/editor/java/NbJMIPaintComponent.java;
/cvs/java/editor/src/org/netbeans/modules/editor/java/NbJMIPaintComponent.java,v
 <--  NbJMIPaintComponent.java
new revision: 1.8; previous revision: 1.7
done
Checking in 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.18; previous revision: 1.17
done
Checking in src/org/netbeans/modules/editor/java/NbJavaJMICompletionQuery.java;
/cvs/java/editor/src/org/netbeans/modules/editor/java/NbJavaJMICompletionQuery.java,v
 <--  NbJavaJMICompletionQuery.java
new revision: 1.11; previous revision: 1.10
Comment 15 Jaromir Uhrik 2005-09-01 10:36:36 UTC
It is not fixed. I type new File(. Then push Ctrl+Space and enter the suggested
constructor. It deletes the left parenthesis so "new File)" is the result.
[daily build #200508311800]
Comment 16 Roman Strobl 2005-09-06 14:33:34 UTC
I have filed a separate P2 issue 63651 for eating of backets. Marking this one
as fixed, it is now possible to display different constructors, their parameters
and javadocs. It works for methods, too. Filling in by pressing enter doesn't
work yet, but that will be tracked in issue 63651. 

There is another newly introduced P2 issue 63649 which seems to be related with
this fix.
Comment 17 Jesse Glick 2005-09-19 20:56:00 UTC
Please also check issue #61884. I'm not sure if it's a duplicate or not.
Comment 18 Martin Roskanin 2005-09-20 08:12:21 UTC
*** Issue 61884 has been marked as a duplicate of this issue. ***
Comment 19 Jaromir Uhrik 2005-09-21 16:06:25 UTC
Verified in dev build #200509210657. The cc correctly shows constructor types on
the top.