Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 330743 - [content assist] constructor completion overwrites in 'insert' mode
Summary: [content assist] constructor completion overwrites in 'insert' mode
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.5   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-20 13:37 EST by Markus Keller CLA
Modified: 2020-03-08 17:03 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2010-11-20 13:37:26 EST
N20101119-2000

Method completion wrongly overwrites text after the caret in Insert mode.

- reset Java content assist preferences to default
- start with this snippet:

	Process pmset = Runtime.getRuntime().exec("pmset -g pslog");
	pmset.getInputStream();

- put caret on the beginning of the second line
- type "new BuffIn"
- Ctrl+Space, Enter
=> result:   "new BufferedInputStream(|in|).getInputStream();"
=> expected: "new BufferedInputStream(|in|)pmset.getInputStream();"
( || marks the selection)
Comment 1 Markus Keller CLA 2012-02-29 19:03:02 EST
Still broken in master. I had almost the same code snippet as in comment 0.
Comment 2 Markus Keller CLA 2012-08-27 10:33:46 EDT
I hit this bug quite frequently. Sometimes, I don't realize immediately that constructor completion is broken and waste time trying to find out what happened.

Raising severity since the IDE must not eat my code.

class Main {
    public static void main(String[] args) {
        System.out.println(new StringBu|args[0]); // insert constructor at |
    }
}
Comment 3 Markus Keller CLA 2013-12-11 08:35:39 EST
Another use case:

import java.io.*;
public class Try {
    Reader open(File file) throws FileNotFoundException {
         return new BufferedReader|new FileReader(file);
    }
}

Delete '|', press Ctrl+Space, press Enter (or Ctrl+Enter). The keyword 'new' is overwritten, regardless of the Completion inserts/overwrites mode:

         return new BufferedReader(null) FileReader(file);
Comment 4 Eclipse Genie CLA 2020-03-08 17:03:28 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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.