Let's refactor code! With this package, you can rename the name of variables and functions easily.
This package works with these language plugins. You can install using the preferences pane.
- JavaScript: js-refactor
with ES6+ support
- CoffeeScript: coffee-refactor
- PHP
- Set cursor to a symbol.
- Start renaming by using
ctrl-alt-r. - Type new name.
- Finish renaming by using
enteror removing cursor from the focused symbol.
- Override keymap by using
Atom > Open Your Keymap. - Override stylesheet by using
Atom > Open Your Stylesheet.
Add refactor as engines in package.json.
{
...
"engines": {
"atom": ">=1.0.0",
"refactor": ">=0.6.0"
},
...
}
You should implement Ripper class in main module.
Ripper.scopeNames []String: [Required] Array of scope name, like 'source.coffee', 'source.js' and all that.Ripper#parse(code String, callback Function): [Required] Parse code, and you should callback when the parsing process is done. Callback specify the params as an array of errorObject. The errorObjectshould have paramsrangeandmessage.Ripper#find(point Point) []Range: [Required] Return an array of found symbols'Rangeat the passedPoint.
{ Range, Point } = require 'atom'
class Riper
@scopeNames: []
parse: (code, callback) ->
# parse code
callback [
range = new Range()
message: 'foo'
]
find: (point) ->
# find references
[
new Range()
new Range()
...
new Range()
]