Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support fixing require statements after moving a file #39

Open
ganemone opened this issue Feb 26, 2015 · 1 comment
Open

Support fixing require statements after moving a file #39

ganemone opened this issue Feb 26, 2015 · 1 comment

Comments

@ganemone
Copy link
Owner

Really annoying to go through all the code and update this. This would be a cool addition.

@dantman
Copy link
Contributor

dantman commented Feb 26, 2015

Note that what we could implement inside NodeRequirer would be fairly limited without being too complex.

The ideal would be to have a node based cli command that can move files and reformat references. ;) And it looks like node-mv already does that.

But here are some extra ideas we can do:

Option A) Allow Ctrl+Shift+I to discover when the cursor is placed over an existing require(...), use part of its value to pre-fill the quick panel, and make sure that we only update the require(...).

Option B) Implement Node Move / Node Rename sidebar context menu items (next to the ones that SideBarEnhancements have) that simply reformats the relative requires for the current file.

Option C) Implement Node Move / Node Rename sidebar context menu items that use node-mv when it's installed.

I'm in favour of A and one of B or C, with caveats.
B is simple but doesn't solve broken references from other files.
C should do proper moves, however if the user has unsaved buffers for files that are modified those will conflict.

An alternate idea might be to intercept SideBarEnhancements' side_bar_rename and side_bar_move commands when in a node based project, re-implements the text input, then pops up a "Would you like to reformat references using node-mv?" question to decide whether to call node-mv or pass the rename/move back to SideBarEnhancements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants