Bug 323508 - [templates][content assist] Code completion in code template overwrites when typed first
Summary: [templates][content assist] Code completion in code template overwrites when ...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 464922 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-08-24 11:17 EDT by T Kruse CLA
Modified: 2023-03-19 13:09 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description T Kruse CLA 2010-08-24 11:17:27 EDT
Build Identifier: 20100617-1415

within active code templates, one can modify variable names and they will change in all template locations, a bit like in refactoring. In addition, code completion is available (not in refactoring). Code completion for methods inserts code correctly UNLESS you type some prefix letters first before choosing a completion.

Reproducible: Always

Steps to Reproduce:
This is a bug that occurs when using code completion in a code template.
It can always be reproduced, but the template needs to remain active (blue frames around variables). If you leave the eclipse window and deactivate the template, the bug does not occur.

to reproduce, write this method:

public static void test(Object obj) {
		i
	}

the cursor shout be after the "i". From now on, do not switch focus from the eclipse window, and press only keys as suggested below. Press Ctrl-Space, select instanceof template.
Code now looks like this:
   if (obj instanceof type) {
    type new_name = (type) obj;
   }

press arrow right to unselect 'obj'.
Press '.'
-> popup opens offering the methods on java.lang.Object.
type 'not'
-> popup offers notify() and notifyAll()
with arrow keys and return, select no notifyAll.

Result, code looks like this:

if (obj.notifyAll()nstanceof type) {
 type new_name = (type) obj.notifyAll();
}

should look like this
if (obj.notifyAll() instanceof type) {
 type new_name = (type) obj.notifyAll();
}

the more you type into code completion before selecting ('notify' instead of 'not') the more gets overwritten.

The same happens also for other templates, not just the instanceof template.
Comment 1 Dani Megert CLA 2010-08-25 02:42:22 EDT
To reproduce one has to select
Java > Editor > Content Assist | Completion overwrites
Comment 2 Noopur Gupta CLA 2015-06-08 07:14:46 EDT
*** Bug 464922 has been marked as a duplicate of this bug. ***
Comment 3 Eclipse Genie CLA 2019-12-22 04:48:13 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 4 Eclipse Genie CLA 2023-03-19 13:09:30 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.