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
}
	}
	private final static char[] METHOD_WITH_ARGUMENTS_TRIGGERS= new char[] { '(', '-' };
	private final static char[] GENERAL_TRIGGERS= new char[] { ';', ',', '.', '\t', '(', '{', '[' };
	
	private ArrayList fFields= new ArrayList(), fKeywords= new ArrayList(), 
						fLabels= new ArrayList(), fMethods= new ArrayList(), 
						fModifiers= new ArrayList(), fPackages= new ArrayList(),
						fTypes= new ArrayList(), fVariables= new ArrayList();
	private IMarker fLastProblem;
	
	private IJavaProject fJavaProject;
	private ICompilationUnit fCompilationUnit;
	
	private ArrayList[] fResults = new ArrayList[] {
		fVariables, fFields, fMethods, fTypes, fKeywords, fModifiers, fLabels, fPackages
	};
	
	private int fUserReplacementLength;
	private int fUserReplacementOffset;
	
	
	/*
	 * @see ICompletionRequestor#acceptClass
	 */	
	public void acceptClass(char[] packageName, char[] typeName, char[] completionName, int modifiers, int start, int end) {
		ProposalInfo info= new ProposalInfo(fJavaProject, packageName, typeName);
		fTypes.add(createTypeCompletion(start, end, new String(completionName), JavaPluginImages.IMG_OBJS_CLASS, new String(typeName), new String(packageName), info));
	}