Bug 3666 CodeCompletion - Hungry code assist (1GDRYW5)
jkca (5/15/2001 11:04:56 AM) jre-sdk 106 Under certain circumstances code assist eats too much code. Consider the enclosed class. As a programmer, I must add a parameter to the baz call in bar to make the program correct. Steps: 1. Change the baz call to baz(x.x.foo()) 2. Place the cursor after the first "x." 3. Ctrl-Space to bring up code assist 4. Type "f" to filter the list. 5. Select, "foo()" 6. The code is changed to: baz(x.foo().foo()) I would rather it gave me baz(x.foo()x.foo()) public class X { void bar(X x) { baz(x.foo()); } int foo() { return 5; } void baz(int i, int j) { } } KUM (5/21/01 9:02:11 AM) The text to replace is computed by the code assist infrastructure. Moved to ITPJCORE. PM (9/4/2001 2:58:56 PM) Option was added. PM (9/25/2001 2:20:50 PM) Removing option. UI can decide whether it wants to use the codeassist end position (until the end of current identifier) or the cursor location it used to start with, so as to control the amount of source to replace. The choice amongst one or the other should be conditioned by a keystroke (enter=replace until end, insert=replace until cursor location). Moving to ITPJUI. Removing codeassist option.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/ResultCollector.java
nameBuffer.append(getParameterSignature(parameterTypeNames, parameterNames));
		}
		nameBuffer.append(')'); 
		if (returnTypeName.length > 0) {
			nameBuffer.append("  "); 
			nameBuffer.append(returnTypeName);
		}
		if (declaringTypeName.length > 0) {
			nameBuffer.append(" - "); 
			nameBuffer.append(declaringTypeName);
		}
		return createCompletion(start, end, new String(completionName), iconName, nameBuffer.toString());
	}
	
	protected JavaCompletionProposal createTypeCompletion(int start, int end, String completion, String iconName, String typeName, String containerName, ProposalInfo proposalInfo) {
		IImportDeclaration importDeclaration= null;
		if (containerName != null && fCompilationUnit != null) {
			if (completion.equals(JavaModelUtil.concatenateName(containerName, typeName))) {
				importDeclaration= fCompilationUnit.getImport(completion);
				completion= typeName;
			}
		}
		StringBuffer buf= new StringBuffer(typeName);
		if (containerName != null) {
			buf.append(" - "); 
			buf.append(containerName);
		}
		String name= buf.toString();
		
		JavaCompletionProposal proposal= createCompletion(start, end, completion, iconName, name);