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

Bug 437687

Summary: "Create Snippet" doesn't handle variable declarations in different blocks
Product: z_Archived Reporter: Marcel Bruch <marcel.bruch>
Component: RecommendersAssignee: Anne-Christine Karpf <acka>
Status: RESOLVED FIXED QA Contact: Johannes Dorn <johannes.dorn>
Severity: enhancement    
Priority: P5 CC: johannes.dorn
Version: unspecifiedKeywords: helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=436694
Whiteboard:

Description Marcel Bruch CLA 2014-06-18 09:34:01 EDT
Given a code fragment like:

{
    // block 1
    String e1;
}
{
    // block 2
    String e1;
}



produces a snippet like:


{
    // block 1 
    String ${e1:newName(java.lang.String)};
}
{
    // block 2
    String ${e1};
}
${:import(java.lang.String)}${cursor}


which is not correct since e1 in the block 2 is not the same as in block 1. Currently there is no scope.


In order to fix this, every variable binding must be traced back to it's defining variable declaration statement and ids must be given based on these definition statements.

It's a half day's work I think.
Comment 1 Johannes Dorn CLA 2014-07-23 05:15:48 EDT
The fix is merged https://git.eclipse.org/r/#/c/30194/

Thanks, Anne!