| Summary: | Improve suggested variable name in Extract Local Variable | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Marc-André Laperle <malaperle> | ||||||
| Component: | cdt-refactoring | Assignee: | Emanuel Graf <emanuel> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | Emanuel Graf <emanuel> | ||||||
| Severity: | enhancement | ||||||||
| Priority: | P3 | CC: | cdtdoug, yevshif | ||||||
| Version: | 7.0 | ||||||||
| Target Milestone: | 7.0.2 | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Marc-André Laperle
Created attachment 185996 [details]
patch
Fixed in HEAD ans 7.0 >20110104 *** cdt cvs genie on behalf of egraf *** Bug 330693: Improve suggested variable name in Extract Local Variable <a href=https://bugs.eclipse.org/bugs/show_bug.cgi?id=330693>https://bugs.eclipse.org/bugs/show_bug.cgi?id=330693</a> [*] ExtractLocalVariable.rts 1.8 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractLocalVariable.rts?root=Tools_Project&r1=1.7&r2=1.8 [*] ExtractLocalVariableRefactoring.java 1.12 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoring.java?root=Tools_Project&r1=1.11&r2=1.12 *** cdt cvs genie on behalf of egraf *** Bug 330693: Improve suggested variable name in Extract Local Variable <a href=https://bugs.eclipse.org/bugs/show_bug.cgi?id=330693>https://bugs.eclipse.org/bugs/show_bug.cgi?id=330693</a> [*] ExtractLocalVariable.rts 1.3.6.4 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractLocalVariable.rts?root=Tools_Project&r1=1.3.6.3&r2=1.3.6.4 [*] ExtractLocalVariableRefactoring.java 1.7.2.2 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoring.java?root=Tools_Project&r1=1.7.2.1&r2=1.7.2.2 Thanks! This is much better. I noticed something while using it: foo->getVarWithLongName() becomes 'name'. I think it should be varWithLongName. What do you think? I think it should remove common prefixes, like get, get_, Get, Get_, lower the first letter after that and keep the rest of the string intact. (In reply to comment #5) > Thanks! This is much better. I noticed something while using it: > > foo->getVarWithLongName() becomes 'name'. I think it should be varWithLongName. > What do you think? > > I think it should remove common prefixes, like get, get_, Get, Get_, lower the > first letter after that and keep the rest of the string intact. Yeah your right that would be far better. I'll change this. Created attachment 186078 [details]
Improved handling of long names
*** cdt cvs genie on behalf of egraf *** bug 330693: Improve suggested variable name in Extract Local Variable <a href=https://bugs.eclipse.org/bugs/show_bug.cgi?id=330693>https://bugs.eclipse.org/bugs/show_bug.cgi?id=330693</a> Improved handling of long names [*] ExtractLocalVariable.rts 1.3.6.5 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractLocalVariable.rts?root=Tools_Project&r1=1.3.6.4&r2=1.3.6.5 [*] ExtractLocalVariableRefactoring.java 1.7.2.3 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoring.java?root=Tools_Project&r1=1.7.2.2&r2=1.7.2.3 *** cdt cvs genie on behalf of egraf *** bug 330693: Improve suggested variable name in Extract Local Variable <a href=https://bugs.eclipse.org/bugs/show_bug.cgi?id=330693>https://bugs.eclipse.org/bugs/show_bug.cgi?id=330693</a> Improved handling of long names [*] ExtractLocalVariableRefactoring.java 1.13 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoring.java?root=Tools_Project&r1=1.12&r2=1.13 [*] ExtractLocalVariable.rts 1.9 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractLocalVariable.rts?root=Tools_Project&r1=1.8&r2=1.9 Very nice! But I tested this for a couple of days and found another issue :) getFoo(getBar()) If I select the whole thing, 'bar' is suggested. Similarly, getFoo(getBar(getFooBar())) fooBar is suggested. I haven't looked at the code closely but some AST magic is probably needed to make sure is gets the 'outer' call before doing string processing. I can open a separate bug if you like. Opened bug 335202 the issue I mentioned. |