Bug 150228

Summary: Code assist for unresolved local variables
Product: [Eclipse Project] JDT Reporter: Dani Megert <daniel_megert>
Component: CoreAssignee: David Audel <david_audel>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: frederic_fusier, mlists
Version: 3.2   
Target Milestone: 3.3 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix
none
Addionnal fix none

Description Dani Megert CLA 2006-07-11 05:26:28 EDT
R3.2

Provide code assist for declarations that are already used later in the code:

	int f<code assist>
	System.out.print(foo);
Comment 1 Dani Megert CLA 2006-07-11 05:27:02 EDT
As discussed at the JDT Summit.
Comment 2 Olivier Thomann CLA 2006-07-11 05:46:26 EDT
Collect potential identifiers in the completion scanner.
Comment 3 Philipe Mulet CLA 2006-09-13 07:37:03 EDT
We could want to only collect identifiers not following a dot or other characters never prefixing a single name ref.
Comment 4 David Audel CLA 2006-10-19 10:19:00 EDT
Created attachment 52315 [details]
Proposed fix
Comment 5 David Audel CLA 2006-10-19 10:43:37 EDT
Released for 3.3 M3.

Test added
  CompletionTests#testCompletionVariableName16() -> testCompletionVariableName32()

Potential identifiers are collected from the end of the local variable to the end of the enclosing block.
Identifiers following a dot are ignored.
Identifiers followed by a ( or { are ignored.
Identifier starting with an uppercase are ignored because most of the type it would be a type reference and not an unresolved name.
Identifiers that would add name conflicts with another variable or field are ignored.

The source are only scanned and parsed with standard recovery (no statements recovery) to avoid to do too costly operation as binding resolution and statements recovery.
Comment 6 David Audel CLA 2006-10-23 12:38:16 EDT
Created attachment 52522 [details]
Addionnal fix

The released fix performances aren't good enough. This patch improve performance and limit to 100 the number of parsed lines.
Comment 7 David Audel CLA 2006-10-23 12:39:37 EDT
Addionnal fix released.
Comment 8 Olivier Thomann CLA 2006-10-30 14:58:26 EST
Verified for 3.3 M3 using warm-up build I20061030-0800