GithubHelp home page GithubHelp logo

zaaack / refactor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hax/refactor

0.0 2.0 0.0 110 KB

Refactoring support in Atom.

Home Page: https://atom.io/packages/refactor

License: MIT License

CoffeeScript 94.63% CSS 5.37%

refactor's Introduction

Refactor Package

Let's refactor code! With this package, you can rename the name of variables and functions easily.

capture_rename

Language Support

This package works with these language plugins. You can install using the preferences pane.

Usage

  1. Set cursor to a symbol.
  2. Start renaming by using ctrl-alt-r.
  3. Type new name.
  4. Finish renaming by using enter or removing cursor from the focused symbol.

User Setting

  • Override keymap by using Atom > Open Your Keymap.

For example, you can override the shortcut to ctrl-alt-e

'atom-text-editor:not(.mini)':
  'ctrl-alt-r': 'unset!'
  'ctrl-alt-e': 'refactor:rename'
  • Override stylesheet by using Atom > Open Your Stylesheet.

API Documentation (for plugin developer)

package.json

Add refactor as engines in package.json.

{
  ...
  "engines": {
    "atom": ">=1.0.0",
    "refactor": ">=0.6.0"
  },
  ...
}

Interface

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 error Object. The error Object should have params range and message.
  • Ripper#find(point Point) []Range : [Required] Return an array of found symbols' Range at the passed Point.
{ 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()
    ]

Examples

See

refactor's People

Contributors

minodisk avatar hax avatar seriema avatar alhadis avatar radekn avatar

Watchers

Zack Young avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.