Handle file rename in .cabal file - #4961
Conversation
f01a8c6 to
f939273
Compare
On WillRename Notification, edit the responsible .cabal file to change the module name entry of the renamed module to the new name.
f939273 to
cfbbef1
Compare
f5de604 to
4eece12
Compare
dyniec
left a comment
There was a problem hiding this comment.
rename yay!
Looks fine,and tests seem alright. Should be fine to merge when CI succeeds
Aster89
left a comment
There was a problem hiding this comment.
Love this!
Some newbie comments below 😆
3d311bb to
2cce790
Compare
2cce790 to
06f6ad0
Compare
| runActionE "cabalAdd.getVersionedTextDoc" ideState $ | ||
| lift $ | ||
| getVersionedTextDoc $ | ||
| TextDocumentIdentifier (filePathToUri cabalFilePath) |
There was a problem hiding this comment.
No, it takes a Uri as defined by the type of TextDocumentIdentifier.
06f6ad0 to
bc3ab5f
Compare
| Maybe.maybe [] exposedModules $ library pd | ||
| LSubLibName _ -> | ||
| concat $ Maybe.concatMapM (getExposedModulesForLib compName) $ subLibraries pd | ||
| _ -> [] |
There was a problem hiding this comment.
| _ -> [] | |
| CNotLibName -> ? |
I think executables can have other-modules and need to be handled here but not 100% sure.
There was a problem hiding this comment.
This is handled later on, the first part here checks only whether the module is in exposed modules if it occurs, since there are more limited cases for this.
If the module still occurs in a field but was not in an exposed module then it has to be in other modules, which would cover the case you proposed.
I changed the code a bit to hopefully improve readability.
80a48ef to
50250f1
Compare
9546635 to
584441e
Compare
584441e to
32e0eb7
Compare
On a
WillRenameFileNotification, we find the responsible.cabalfile for the old filepath and replace the corresponding module path with the module path for the new file name.This is part of the implementation of #4951.
In the next PR, I will propagate the rename in Haskell files, i.e. rename in module declaration and imports.
Screencast.From.2026-06-08.10-19-12.mp4