Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 59104

Summary: [Content Assist] Wrong completion proposals when prefix is empty
Product: [Tools] CDT Reporter: James Ciesielski <jciesiel>
Component: cdt-parserAssignee: Hoda Amer <hamer>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P1    
Version: 2.0   
Target Milestone: 2.0   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:
Bug Depends on: 50807    
Bug Blocks:    

Description James Ciesielski CLA 2004-04-19 13:30:32 EDT
CDT 2.0.0.200404190838
Eclipse (200404131323)

Test case:
1. Create a standard C project, call it StdC.
2. Add a file to StdC, call it main.c and insert the following code:
	#include <stdio.h>
	
	int
	main(int argc, char **argv) {
		printf("Hello world\n");
	    
		int nMyInt = 0;
	
		int i = [^SPC]  // ** (A) **
		
		printf("\nThis is my number: %d\n", [^SPC] ); // ** (B)
	}
3. Add a file to StdC, call it makefile and insert the following:
	all:
		gcc main.c
4. Enable automatic scanner config and build.  (The build will fail, but we are
only trying to get the scanner config stuff at this point.)
5. Execute content assist on line (A) (no prefix)

RESULT: A completion list is presented to the user that contains duplicate
entries for all local variables.

6. Execute content assist on line (B) (no prefix)

RESULT: The completion list does not contain any of the local variables and
printf() is at the top of the list.


EXPECTED: (A) - A completion list with no duplicates.  (B) - Local variables
should be offered and listed at the top of the completion list.
Comment 1 John Camelon CLA 2004-04-20 15:46:13 EDT
Add dependency to bug 50807 which is the placeholder for work regarding B.
Assign to Hoda to have her deal w/duplicate elements in the proposal list.  
Comment 2 Hoda Amer CLA 2004-04-21 13:02:26 EDT
Duplication of local variables has been solved in HEAD.
Comment 3 Hoda Amer CLA 2004-04-21 14:27:06 EDT
This is an error in completion on function reference. It is not major. 
Reducing severity to normal.
Comment 4 Andrew Niefer CLA 2004-06-03 10:42:53 EDT
See bug 50807
When doing content assist in the parameter list of a function call, there are 2 
different modes: with prefix and without prefix.

void f( []     //1
void f( 1, []  //2
void f( a[]    //3
void f( a, b[] //4

Content assist after the bracket of comma without a prefix (1,2), will return a 
set of functions with the same name and matching parameters.  ie at 1, expect 
all callable functions called f, at 2 expect all callable functions named f 
that take more than 1 parameter and whose first parameter can accept a '1'.

Content assist after the bracket or comma with a prefix (3, 4) will return 
completions of variables and fields  starting with that prefix.

So without a prefix completes function candidates ,with a prefix completes 
argument candidates.

In the original example, you CA at (B) should result in printf being proposed.
CA at: printf( "words", n[^SPC] should result in local variables (nMyInt)

Comment 5 Pixy CLA 2004-06-07 18:38:18 EDT
This defect is verified on build Eclipse build 200405210800 aand CDT build 
200405290301, and it passes.

Pixy.