feat: open current exercise via --editor#2204
Open
pacexy wants to merge 6 commits intorust-lang:mainfrom
Open
Conversation
--editor--editor
|
No interest in merging this? |
mo8it
requested changes
Mar 14, 2026
| show_key(b'l', b":list / ")?; | ||
| show_key(b'c', b":check all / ")?; | ||
| show_key(b'x', b":reset / ")?; | ||
| show_key(b'e', b":edit / ")?; |
Contributor
There was a problem hiding this comment.
This should only be shown if --editor is passed
| if let Err(e) = self.app_state.current_exercise().open_in_editor(editor) { | ||
| writeln!(stdout, "Failed to open editor: {}", e)?; | ||
| } | ||
| } else { |
Contributor
There was a problem hiding this comment.
If --editor is not passed, then entering e should be ignored
|
|
||
| continue; | ||
| } | ||
| KeyCode::Char('e') => InputEvent::Edit, |
Contributor
There was a problem hiding this comment.
Ignoring e should happen here
|
|
||
| /// Open the exercise file in the specified editor | ||
| pub fn open_in_editor(&self, editor: &str) -> io::Result<bool> { | ||
| let parts: Vec<&str> = editor.split_whitespace().collect(); |
Contributor
There was a problem hiding this comment.
You should use shlex instead of split_whitespace
|
|
||
| ```bash | ||
| rustlings --editor code # For VS Code | ||
| rustlings --editor vim # For Vim |
Contributor
There was a problem hiding this comment.
I don't want to advertise using a terminal editor with --editor because it would cover Rustlings and eliminate its interactive design.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements the
--edit-cmdsuggested in #2164 (comment). But with the name--editorthe same as git.close #2164