Bug 484927 - Support emacs style replace behaviour matching case
Summary: Support emacs style replace behaviour matching case
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-27 11:50 EST by Sandip Chitale CLA
Modified: 2015-12-27 11:50 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sandip Chitale CLA 2015-12-27 11:50:04 EST
Many time I copy a file and the only difference is that I need to map a noun to another.e.g.

firstName -> lastName

getFirstName() -> getLastName()

FIRSTNAME -> LASTNAME

and even better:

FIRST_NAME -> LAST_NAME

FIRST-NAME -> LAST-NAME

This is supported by emacs to some extent. See below.

The Eclipse find/replace dialog should support this using a Case mapping chekbox option:

__ Options ____________________

[ ] Case sensitive

    [X] Case mapping

Some languages use camel case, some use hyphen or underscore. The dialog could take that into account.

Support Emacs style case matching replace behavior.

"
15.10.3 Replace Commands and Case
:
:
In addition, when the newstring argument is all or partly lower case, replacement commands try to preserve the case pattern of each occurrence. Thus, the command

M-x replace-string RET foo RET bar RET
replaces a lower case ‘foo’ with a lower case ‘bar’, an all-caps ‘FOO’ with ‘BAR’, and a capitalized ‘Foo’ with ‘Bar’. (These three alternatives—lower case, all caps, and capitalized, are the only ones that replace-string can distinguish.)

If upper-case letters are used in the replacement string, they remain upper case every time that text is inserted. If upper-case letters are used in the first argument, the second argument is always substituted exactly as given, with no case conversion. Likewise, if either case-replace or case-fold-search is set to nil, replacement is done without case conversion.
"

REF: http://www.gnu.org/software/emacs/manual/html_node/emacs/Replacement-and-Case.html#Replacement-and-Case