jurassix / atom-javascript-refactor

atom plugin that provides refactoring support for JavaScript
MIT License
32 stars 3 forks source link

Doesn't work for me :( #118

Open gigaga opened 7 years ago

gigaga commented 7 years ago

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?

jurassix commented 7 years ago

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.

gigaga commented 7 years ago

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 :-(

jurassix commented 7 years ago

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.

gigaga commented 7 years ago

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';

jurassix commented 7 years ago

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?

gigaga commented 7 years ago

Hi,

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

Best regards,

jurassix commented 7 years ago

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

Clinton.ayres@gmail.com

dantman commented 6 years ago

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')