Bug 77301 - instanceof codeassist doesn't recognize instanceof java keyword
Summary: instanceof codeassist doesn't recognize instanceof java keyword
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.1 M7   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-29 10:38 EDT by Thibault Kruse CLA
Modified: 2005-04-29 11:32 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thibault Kruse CLA 2004-10-29 10:38:20 EDT
Hi,

in the Eclipse 3.1 M2 JDT, the CodeAssist (Ctrl+Space) does not 
propose "instanceof" as a keyword for completion, only the whole instanceof
statement. This was different in Eclipse 3.0 and is annoyin,
beacuse when you type

if (anyObject inst

And press Ctrl+Space,

it will automatically generate

if (anyObject if (name instanceof type) {
                type new_name = (type) name;
                
            })

bye
Comment 1 Dirk Baeumer CLA 2004-10-31 13:32:42 EST
Keywords are proposed by Core. Moving...
Comment 2 Trevor Robinson CLA 2005-03-15 18:38:50 EST
I'm running N20050303-0010, which, in the context described above, correctly
proposes both:
instanceof - dynamic type test and cast
instanceof (keyword)

However, when selecting the 'dynamic type test and cast' option, it redundantly
blurts out the entire associated code snippet inside the existing 'if', as shown
above. It seems to me that this assist should recognize it is already in an 'if'
condition and complete it appropriately. For example:

if (anyObject inst

would complete to:

if (anyObject instanceof type) {
    type new_name = (type) anyObject;

}
Comment 3 David Audel CLA 2005-04-29 08:03:56 EDT
I could not reproduce the bug in I20050426-1700

For the second problem: 'dynamic type test and cast' is not a java completion
but a template completion and template completion only look the current token.

Close.
Comment 4 Trevor Robinson CLA 2005-04-29 11:00:05 EDT
(In reply to comment #3)
> For the second problem: 'dynamic type test and cast' is not a java completion
> but a template completion and template completion only look the current token.
> 
> Close.

Okay, so that's the technical explanation of why it's doing the wrong thing, but
it's still doing the wrong thing... Should I open a separate issue for it?
Comment 5 David Audel CLA 2005-04-29 11:32:53 EDT
The template completion is not a 'contextual' completion. The template
completion replace a textual shortcut with a defined template (you can define
your own template inside "Preferences>java>Editor>Templates").

But if you think that's would be better to be more contextual sensitive, you
should enter a feature request against JDT/UI.