atom-javascript-refactor icon indicating copy to clipboard operation
atom-javascript-refactor copied to clipboard

Doesn't work for me :(

Open gigaga opened this issue 7 years ago • 8 comments

Hi,

I tried this package after installing it directly from Atom packages manager. I have a file User.jsx with the following content : import api from './Api';

From rename with refactor Atom menu, I renamed my Api.jsx file into Api2.jsx but the content of User.jsx file is not changed :-(

I tried after changing file format settings of package (js to jsx), but same result, no change.

Can you help me with this issue?

gigaga avatar Mar 24 '17 20:03 gigaga

Sure. I think the issue is that I'm filtering files by .js extension, and your examples are .jsx

I think it's safe to assume .jsx is JavaScript so I should be able to relax this to support your needs.

On first look I think this line is restricting you: https://github.com/jurassix/atom-javascript-refactor/blob/81f44366915204dfc2f82cf47bc61fb5f95507e4/lib/renamePaths.js#L26

I think we can also assume .css and .json files may be referenced from JavaScript files as well and should be included.

For now try again with .js and assert that the package is working. I'll put together a PR to handle these extra file extentions.

Thanks for opening an issue. I'll close it out once you verify it's working for .js files.

jurassix avatar Mar 25 '17 03:03 jurassix

Thanks a lot for your help! I tried your proposal by renaming my files with .js extension but I have the same result, no effect :-(

gigaga avatar Mar 25 '17 08:03 gigaga

Ok can you start simple. Can you clone this repo and open the project in atom. Then use rename (move) any file under lib/ folder and check your git status and see if the codemods kicked in.

The reason I'm asking for this is that there are some conventions in the project, git controlled project root. I know they work under these circumstances. So if we can get this working then we can figure out the difference with your setup.

jurassix avatar Mar 25 '17 13:03 jurassix

I tried to rename reducer.js into reducer2.js but I have the same problem :( In atom-javascript-refactor.js. There iss still import reducer from './reducer';

gigaga avatar Mar 27 '17 11:03 gigaga

Ok try this. Can you go to Atom Settings (cmd + ,) then Packages tab, and find the javascript-refactor package. Open the Settings and enable Run in band. Might even need to restart Atom afterwards.

Then try the above refactor test again.

Also, you are choosing the Rename (with Refactor Support) from the context menu correct?

jurassix avatar Mar 29 '17 17:03 jurassix

Hi,

Same problem :(. I can share a screen capture of my test if you provide to me your mail address.

Best regards,

gigaga avatar Mar 30 '17 08:03 gigaga

Yeah I'm open to a google hangout too. I know this works, so would like to get u going as well.

[email protected]

jurassix avatar Mar 30 '17 12:03 jurassix

I had the same issue (my files are .mjs), updating (extname(previousPath) === '.js' && extname(nextPath) === '.js') to this made it work:

      (extname(previousPath) === '.js' && extname(nextPath) === '.js') ||
      (extname(previousPath) === '.jsx' && extname(nextPath) === '.jsx') ||
      (extname(previousPath) === '.mjs' && extname(nextPath) === '.mjs')

dantman avatar Mar 26 '18 01:03 dantman