rustlings icon indicating copy to clipboard operation
rustlings copied to clipboard

Can you please add numbers to the exercises folders so that they come in the same order as in rustlings watch?

Open TimothyAlexisVass opened this issue 3 years ago • 13 comments

I think it would be helpful to get started easily.

TimothyAlexisVass avatar Jul 29 '21 12:07 TimothyAlexisVass

This is a nice suggestion.

You could do that yourself by making the necessary change and raising a pull request. If the repository owners feel good about the change then it would go into rustlings :)

suryapandian avatar Aug 04 '21 14:08 suryapandian

It will make adding exercises folder in the middle very annoying.

anuk909 avatar Sep 19 '21 11:09 anuk909

Personally, I think this would do more harm than good. There's already suffix numbers (e.g. variables1), so I fear adding more numbers in the file path would make it more confusing to parse. That's my opinion, though, what do you think @AbdouSeck @jrvidal?

shadows-withal avatar Sep 21 '21 08:09 shadows-withal

@diannasoriel All data and hints are defined in info.toml. So adding support to folder numbering will not make parsing more confusing.

@anuk909 yep, it is true. You will need to update all folder numbers after the new folder is inserted.

VMois avatar Sep 28 '21 15:09 VMois

@VMois Sorry, I meant more confusing to parse visually, as someone who runs through these exercises.

shadows-withal avatar Sep 28 '21 15:09 shadows-withal

What about just give the ability to list the folders in the correct order, without adding numbers to them? This way there will not be any hassle adding more exercises in-between existing ones.

As a suggestion, it could be a sub-command to the rustlings binary. And it could maybe also show the solution status for each folder.

$ rustlings list
intro/       [ PASS ]
variables/   [ FAIL ]  # Unit tests exists which fails
functions/   [ERRORS]  # Compilation errors exists
...

As of now you can get the correct order of the folders (and quizzes) with the following command:

$ grep -Po '(?<=path = "exercises/)[^/]+(/|\.rs)' info.toml | uniq

Svintooo avatar Feb 14 '22 13:02 Svintooo

I just encountered this problem.

Started the course via rustlings watch then had to search for the file I should edit. Luckily the hint intro1 gave it away. For all following exercises I relied on VSCodes ctrl+click feature on the file path in the compiler message to open the relevant file without searching.

Since there are 20+ subdirectories and potentially more to come I suggest some way to clarify this for new users, especially for the very first intro without compiler error explicitly stating the file path. Numbering the exercises would be an easy solution but as mentioned above maintainability might suffer. Another issue to keep in mind is that not all operating systems sort folders consistently.

A neat feature to streamline the experience (imho) would be to automatically open the related file in the current/default editor, if feasible.

DC4JG avatar Jun 26 '22 21:06 DC4JG

What's the status of this? I'm annoyed by the random ordering every time I go back to rustlings, I'd be happy to contribute a PR if that'd be helpful. I see there's the abandoned/closed #841 PR, but that's about it

RedTachyon avatar Aug 04 '22 23:08 RedTachyon

I maintain my stance that this would cause more confusion than it would help most people 🤷 rustlings watch already tells you the full path of the current exercise, there's really no need to add a bunch of numbers to each folder, if we really want to do something about the underlying problem, there has to be a more elegant solution.

shadows-withal avatar Aug 05 '22 07:08 shadows-withal

I don't really see how it would cause confusion. I'm thinking about a simple naming scheme:

01_functions
02_if
03_enums
04_conversions
...

(the order is probably not correct because it is a hassle to figure out the right order)

It's pretty clear for me that it indicates the order in which the directories are meant to be explored

RedTachyon avatar Aug 05 '22 23:08 RedTachyon

I suppose I'm failing to see the use case here. Most people would use rustlings watch which tells you the path of the current/next exercise. rustlings verify does the same thing. Why would we need this?

shadows-withal avatar Aug 06 '22 19:08 shadows-withal

I agree that numbering the folders would be nice, so you can get an overview of the exercise order without running rustlings.

But I also agree that this would be harder to maintain:

  • adding/removing exercises would need to change the number on a lot of exercise folders.
  • collaborators would risk having the folder their working in suddenly changing path when doing a git pull.

A suggestion could be to create a new folder that contains symlinks to all exercise folders, and these symlinks are numbered. And that these symlinks could be generated/updated by a rustlings subcommand. This way no maintenance would be needed.

Svintooo avatar Aug 20 '22 16:08 Svintooo

Some files are still out of order, namely

├── 19_smart_pointers
│   ├── arc1.rs
│   ├── box1.rs
│   ├── cow1.rs
│   ├── rc1.rs
│   └── README.md
└── 23_conversions
    ├── as_ref_mut.rs
    ├── from_into.rs
    ├── from_str.rs
    ├── README.md
    ├── try_from_into.rs
    └── using_as.rs

nils-werner avatar Nov 19 '23 12:11 nils-werner