Stream: t-compiler/wg-rls-2.0

Topic: feature: move mod to new file


Cole Lawrence (May 09 2020 at 15:59, on Zulip):

Hi, I have an idea for a feature that might already be tracked, but I'm not finding it anywhere.
When I write mod nonexistent_module; I get a code action for creating the module, which will create a new file.
I'm interested in writing a module with the mod nonexistent_module { ... } syntax, and then once it's in a sufficiently complex state, I can move the contents of the mod "..." into a new file.
Would that feature be hard to add? I think it would really help my team understand Rust's module system incrementally, so we can write our code in modules by default (using mod name { ... }) and move them into their own files "safely" as they become sufficiently complex. It would also make the process of refactoring large amounts of interdependent code a little easier by allowing you to do all the module organization and dependency resolving in one file, and incrementally break the file up into modules.

matklad (May 09 2020 at 16:52, on Zulip):

Yes, I've been waiting for this feature for a long time, but never got to actually implementing it.

matklad (May 09 2020 at 16:52, on Zulip):

Shouldn't be hard to add (it should be an assist), though, at the moment, we do some refactorings in the area, so some slight merge conflicts are expected

Timo Freiberg (May 10 2020 at 10:03, on Zulip):

Hooray for more helpful assists!

Last update: Sep 22 2020 at 02:00UTC