rojo-rbx / rojo

Rojo enables Roblox developers to use professional-grade software engineering tools
https://rojo.space
Mozilla Public License 2.0
938 stars 176 forks source link

Allow init scripts to be prepended with an underscore #246

Closed Nimblz closed 4 years ago

Nimblz commented 4 years ago

For libraries with many child modules I find myself having to search for init.lua

Rojo should recognize init scripts with a name like _init

This sorts these files at the very top of their directory (when sorting alphabetically) and better visually groups them with their parent directory when viewed as a tree (see images).

Without underscore: Code_v9m871atqK

With underscore: image

LPGhatguy commented 4 years ago

This makes sense, but I'm unsure if this feature is worthwhile from a duplication and consistency perspective.

A comparison of equivalent features from other languages:

If we had to go back to when I created the first init.lua file at Roblox, maybe it should've been __init__.lua instead?

osyrisrblx commented 4 years ago

What happens if you have both _init.lua and init.lua? Rojo explodes?

Nimblz commented 4 years ago

It could skip over that script+children, then warn the user that the source is ambiguous and as such it cant reconcile that portion.

LPGhatguy commented 4 years ago

We already have to face that problem when init.lua, init.server.lua, init.client.lua, and init.meta.json are specified together. Right now, we just do Something Unspecified, but we should probably tell the user something is up.

LPGhatguy commented 4 years ago

I'm going to go ahead and close this issue. We can revisit it at a later time, but I think consistency is more important right now.