Bug 139621 - [javadoc][assist] No Javadoc completions if there's no member below
Summary: [javadoc][assist] No Javadoc completions if there's no member below
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M4   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 149141
  Show dependency tree
 
Reported: 2006-05-01 17:38 EDT by Rob Grzywinski CLA
Modified: 2006-12-12 06:55 EST (History)
2 users (show)

See Also:


Attachments
Proposed patch (4.50 KB, patch)
2006-11-19 14:54 EST, Frederic Fusier CLA
no flags Details | Diff
Additional patch (20.52 KB, patch)
2006-11-21 06:17 EST, Frederic Fusier CLA
no flags Details | Diff
Modified additional patch (20.40 KB, patch)
2006-11-21 07:23 EST, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rob Grzywinski CLA 2006-05-01 17:38:41 EDT
When I try to get completion (ctrl+space) on "@link" on any type that has mutiple references in my classpath (bad wording but an example is "List" -- "java.util.List" and "org.eclipse.swt.widgets.List") I get no proposals.  I *do* get proposals when not within a javadoc.

In fact, I don't get proposals if I type "{@link java.util.Lis}" and hit complete after the "s" in "Lis".

Perhaps related to this is the fact that I cannot immediately open a type ("Open Declaration") in the same cases.  For example hitting F3 withiin "{@link java.util.List}" gives me the dialog of types rather than just brining me to the fully specified type.  (NOTE that no "List" is included as an "import".)  This "Open Declaration" case may be expected behavior.  I'm not sure.  I'm just mentioning it in relation to the bug.
Comment 1 Dani Megert CLA 2006-05-02 10:55:49 EDT
Works for me using 3.2 RC2.
Comment 2 Rob Grzywinski CLA 2006-05-02 11:04:25 EDT
After stopping and starting Eclipse I don't have this problem any more either (nor can I reproduce it).  I can understand the "worksforsome" but given that there was some conditions that caused proposals to stop working I don't know if I would sleep well at night ... =D

I guess I will continue to hunt for the elusive "reproducable case".
Comment 3 Rob Grzywinski CLA 2006-05-03 12:00:58 EDT
I can reliably reproduce this in the following case:

o  Create a new class.
o  Within the body of the class create a javadoc comment. 
   -  Type "/**" then hit return.  The full javadoc appears and the cursor is placed after the "*".
o  Type "{@link Map" and hit ctrl+space for completeion.  *There are no proposals.*
o  Add "public int foo;" after the javadoc.
o  Go back up to the "{@link Map" and hit ctrl+space.  There *are* proposals.

This will occur in *all* cases where there is no "code" below the Javadoc.

Yes, I'm one of the crazy bastards that writes comments *before* the code.  I call it CFD (comment-first development).  It goes hand in hand with TDD =D

I'm not reopening the bug since I don't know if this is "expected behavior".  If it is, I will open a feature request (or a regression since this used to work in 3.1).
Comment 4 Dani Megert CLA 2006-05-03 12:15:29 EDT
Good catch
Comment 5 Dani Megert CLA 2006-05-03 12:16:47 EDT
This is a regression from 3.1.x and should be considered for 3.2 since otherwise it's not possible to write Javadoc before writting the signature.
Comment 6 Rob Grzywinski CLA 2006-05-03 12:35:22 EDT
Good to know that I'm not crazy =D  Let me know if I can be of any help testing and the whatnot.
Comment 7 Frederic Fusier CLA 2006-05-03 12:47:53 EDT
Code assist in Javadoc was done by JDT/Text in 3.1 and moved to JDT/Core since 3.2. Until the field declaration is written, the javadoc is not attached to it and compiler does not parse javadoc comments in this case. So, it fails to propose anything while completing in this standalone comment.

I agree this is a little bit annoying but does not sound critical for 3.2. Moreover, there's a simple workaround: just write field declaration before trying to complete in the javadoc...

We clearly have to fix this but unfortunately as we'd surely need to change compiler javadoc read mechanism, I definitely prefer to defer this work on next version...
Comment 8 Rob Grzywinski CLA 2006-05-03 13:10:04 EDT
Well, given that I'm already annoyed with how type completion works in javadocs in relation to imports (specifically when you have "Unused import" configured to be a compiler error), I suppose it wont kill me to be a little more annoyed.

Thanks!
Comment 9 Frederic Fusier CLA 2006-11-19 14:54:37 EST
Created attachment 54137 [details]
Proposed patch
Comment 10 Frederic Fusier CLA 2006-11-19 14:55:07 EST
Released for 3.3 M4 in HEAD stream.
Comment 11 Frederic Fusier CLA 2006-11-21 06:17:27 EST
Created attachment 54249 [details]
Additional patch

Additional changes to address some issues discovered in previous patch...
Comment 12 Frederic Fusier CLA 2006-11-21 07:23:59 EST
Created attachment 54257 [details]
Modified additional patch

Use CompletionParser.FAKE_TYPE_NAME for fake type declaration name in case of completion in an orphan comment in a compilation unit without type.
Comment 13 David Audel CLA 2006-12-12 06:55:46 EST
Verified for 3.3M4 with I20061212-0010.