You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
It would be great to be able to move existing symbol (variable, function, class) to an existing file. Right now we can only "extract function" to a new file. A feature like this is present in IntelliJ products and VSCode refactoring tools.
I image that this would open a file picker (telescope/enhanced selection popup from nvim dressing would be great, I am not so sure about native nvim selection UI) and let the user choose the file where the symbol should be moved to.
This would be especially helpful if the refactoring tool was able to move code with necessary dependencies (e.g. Python import statements with modules used inside the function that is to be moved). This behaviour has been mentioned in slightly different context in #331. This would also require other modules to change how they import the symbol that is being moved (so they import it from the new location).
This could be expanded even more to enhance existing "extract function to file", which could then be split into "extract function to new file" (would work as it does now), and "extract function to existing file" which would combine extracting function with moving it to one of existing files via file picker. Moving modules would also be great (effectively this would be renaming files with updating other modules that depend on it to update they imports to the new name/location).
The text was updated successfully, but these errors were encountered:
Right now we can only "extract function" to a new file
Maybe it isn't really clear on the README, but currently it is possible to extract function to either a new file or an already existing file.
It would be great to be able to move existing symbol (variable, function, class).
This is different from the "extract function" functionality. Extract function extracts some code into a new function.
This would be especially helpful if the refactoring tool was able to move code with necessary dependencies
This would mean entering LSP territory. Currently, the plugin only uses treesitter to get all of the information for the refactorings. Any PR adding this functionality is welcome :3.
Moving modules would also be great (effectively this would be renaming files with updating other modules that depend on it to update they imports to the new name/location).
Some LSPs already support this, you can check plugins like nvim-lsp-file-operations that integrate this into Neovim.
Maybe it isn't really clear on the README, but currently it is possible to extract function to either a new file or an already existing file.
Thanks, I didn't think of that. Indeed, this works. I've also found out that CTRL-X CTRL-F works for path completion when specifying the file to extract the function to, which is quite convenient.
I don't know Lua enough to work on the features I've requested. For me, this issue can be closed (or left open if you want to keep it as a feature request for the future).
Hi!
It would be great to be able to move existing symbol (variable, function, class) to an existing file. Right now we can only "extract function" to a new file. A feature like this is present in IntelliJ products and VSCode refactoring tools.
I image that this would open a file picker (telescope/enhanced selection popup from nvim dressing would be great, I am not so sure about native nvim selection UI) and let the user choose the file where the symbol should be moved to.
This would be especially helpful if the refactoring tool was able to move code with necessary dependencies (e.g. Python
import
statements with modules used inside the function that is to be moved). This behaviour has been mentioned in slightly different context in #331. This would also require other modules to change how they import the symbol that is being moved (so they import it from the new location).This could be expanded even more to enhance existing "extract function to file", which could then be split into "extract function to new file" (would work as it does now), and "extract function to existing file" which would combine extracting function with moving it to one of existing files via file picker. Moving modules would also be great (effectively this would be renaming files with updating other modules that depend on it to update they imports to the new name/location).
The text was updated successfully, but these errors were encountered: