LightRefactor
LightRefactor is a new plugin for Eclipse for semi-automatic renaming of identifiers in JavaScript programs.
Installation:
- Intall Eclipse SDK 4 (Juno)
- Install the following using Eclipse's update manager:
- Xtend 2.4.1 from the Xtend Update Site http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases/
- JavaScript Development Tools (JSDT) from the Juno update site ("Programming Languages" category)
- LightRefactor from the update site http://www.brics.dk/jsrefactor/renaming/
Usage:
- Open a JavaScript file in Eclipse's JavaScript editor.
- Place the caret on a JavaScript identifier.
- Press Ctrl+R to rename that token.
Source code: see the light-refactor github page.
JSRefactor
The JSRefactor plugin is developed to experiment with the technique presented in the paper Tool-supported refactoring for JavaScript published at OOPSLA'11.
To try the plugin, follow these instructions:- Read the limitations above and make sure you understand them.
- Add this update site to Eclipse: http://www.brics.dk/jsrefactor/eclipse
- Install the plugin available from the update site. It may take a long time for Eclipse to resolve its dependencies.
- Open a JavaScript file in Eclipse's JavaScript editor.
- These three refactorings should now be available from the menu called "Refactoring":
- Rename property (do not confuse with the existing refactoring simply called rename)
- Encapsulate property
- Extract module
- It does not work on JavaScript embedded in HTML files.
- It does not refactor multiple files. All your JavaScript code is assumed to be in the same file.
- The warnings produced by the tool are not always that helpful.
- Dead code is ignored. You may be surprised if you try to refactor a half-complete program.
- And therefore, it does not work well on library code.
- If your code is very complex, the underlying pointer analysis may take a long time and/or use lots of memory.
Please send questions and comments to asf@cs.au.dk;amoeller@cs.au.dk.