WebStorm 8 javascript variable name refactoring not working in node.js project
I have tried to rename javascript variables declared as objects or classes in nodejs projects, however the refactoring fails to find the usage of such variables either totally or partially.
Any example screenshot is attached where a local scope variable within a function is only found once; however it is used twice. Similarly at other instances it totally failes to find the usage.
A normal find and replace is able to find the names though.
I am using linux and Webstorm version is 8.0.4 build #ws-135.1063 jre version is 1.7.0 67-b01 amd64.
Attachment(s):
screenshot.zip
Please sign in to leave a comment.
Please can you attach the file (or code snippet as text)?
Please also check if the problem persists after invalidating caches (File/Invalidate caches, restart)
Hi Elena,
I did some additional trouble shooting.I did try your suggestion but what fixed the issue was as follows:
I had added the main source code folder (lib folder) to the settings-> javascript -> libraries folders list. I had done this to get intellisense for my own code. However that cause it not to refactor those variables. Do you still want me to past the code snippet or does that make sense.
Also please suggest if I want to get intellisense for my own code what should I do.
Thanks.
I see now, thanks for clearing it up:) Files added to javascript libraries are read-only in IDE and thus are out of refactoring scope. Library files write protection was implemented by design to prevent users from making accidental modifications.
By default, completion works for all JavaScript files located under your project root. So, if your own code is located in your project root, it's enough to gewt intellisence. See http://blog.jetbrains.com/webstorm/2014/07/how-webstorm-works-completion-for-javascript-libraries/ for some hints