5

I am asking this question as I need some updates on the duplicates below which are outdated: Eclipse>WST>JSDT Javascript Refactoring

How do you refactor JavaScript, HTML, CSS, etc?

All I want to do with refactoring is to rename my variable/function names throughout my html/javascript project. So nothing beyond that I need. So is there any reliable eclipse plugins, etc.

Please dont advice me to go for JetBrains products such as webstorm or intellij. I would like to stick with eclipse. I have tested netbeans and many other ides as well.

Community
  • 1
  • 1
C graphics
  • 7,308
  • 19
  • 83
  • 134
  • One of the downsides to using a loosely-typed language -- fully automatic and robust refactoring is not always possible and/or is very difficult. – SnakeDoc Dec 13 '13 at 18:50
  • Agree, but at least they could do as good as webstorm. That much suffices me. – C graphics Dec 13 '13 at 18:53
  • I have the ADT, which came with Eclipse 4.2.1 , and in that, the option to refactor > rename is consistently there for all the code.. – sanjeev mk Dec 21 '13 at 00:32
  • @sanjeevmk thanks for your comment, but what do you mean by ADT?Could you elaborate please – C graphics Dec 24 '13 at 01:47
  • @Cgraphics ADT is the Android Developers' Tool bundle. Eclipse is provided as part of that bundle. The bundle version I have , has Eclipse 4.2.1 – sanjeev mk Dec 24 '13 at 08:05
  • Did you try [this](http://wiki.eclipse.org/JSDT) and [these](http://www.eclipse.org/webtools/jsdt/) ? I used them long time ago and do not remember exactly of their support for the refactoring. But I hope they definitely include this feature by now at least. ( such a major feature !!). @SnakeDoc, renaming has nothing to do with types as compiler distinguishes variable names from normal code. – Siva Tumma Dec 27 '13 at 08:20

1 Answers1

0

This is not the answer you wanted, it's the one you need. Re-factoring is an activity mostly beyond the scope of automation. There are many tools one may use, but the one you dislike (search/replace), is the one you can fall back on when the automated re-factoring tools fall short; i.e. are not up to your level of abstract reasoning and intelligence. You could read this book and it will help your development skills immeasurably.

If as you say "all you want to do is rename" Notepad++ allows you to do a search/replace in multiple files. Eclipse does this too if I'm not mistaken.

What you can do to improve the process and make the error prone hand coding less onerous is use unit testing, try QUnit. You could look at that and the ideas behind Test Driven Development in general. Its not easy to apply automated testing to HTML or CSS as they are declarative and you need to eyeball the resultant screens (as a quality control activity)

My point is you are not going to get what you are looking for, not where you are looking for it. But there is more to find. Good luck

Community
  • 1
  • 1
Kickaha
  • 3,680
  • 6
  • 38
  • 57