Eclipse>WST>JSDT Javascript Refactoring Renaming variables working half of the time

不羁的心 提交于 2019-11-29 05:08:58

You can always use Ctrl + 2 + R (Press R after appearing a small dropdown) to refactor the variable... [ Got it by chance ].

Update

working on Eclipse Neon... can't say about other older version. because it is the latest stable version at the time I am writing the answer.

Update 3-May-2017

one drawback is that it replaces all occurrences of that variable in the file. special care is required.

I noticed that renaming is not available, when the project is not a JS project or if I open it with the non-default JS editor. (Spket JS Editor in my case.)

So try this:

  • Make sure in your .project file jsNature is set.

E.g. (In my case I have JS code inside a Java project):

<natures>
    <nature>org.eclipse.jdt.core.javanature</nature>
    <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
  • Right click file -> Open with -> JavaScript Editor

Works for my using Eclipse Kepler.

I can rename the local variable under Aptana Studio 3.0 (Eclipse based) with the JSDT "JavaScript Editor" and in the screenshot shown JS function: http://imgur.com/246oTY5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!