Skip to content

Conversation

@dfayd0
Copy link
Member

@dfayd0 dfayd0 commented Jul 12, 2025

No description provided.

@dfayd0 dfayd0 requested a review from Copilot July 12, 2025 11:46
@dfayd0 dfayd0 self-assigned this Jul 12, 2025
@dfayd0 dfayd0 linked an issue Jul 12, 2025 that may be closed by this pull request
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a fallback prompt loop when the configured or provided default language is invalid, adjusts error types for parsing languages, and extends the API runner with helper methods for fetching problem details.

  • Changed parse_programming_language to return std::io::Error and added a re-prompt function prompt_for_language
  • Updated main.rs to loop on invalid language input until a supported language is entered
  • Introduced get_problem_name and get_available_languages in the API runner and improved client initialization error handling

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/utils.rs Changed parse errors to io::Error, added prompt_for_language
src/main.rs Integrated prompt loop for default language and retry logic
src/leetcode_api_runner.rs Added get_problem_name, get_available_languages, and enhanced error handling in client setup
Comments suppressed due to low confidence (2)

src/utils.rs:37

  • Using std::io::Error to represent a language-parse failure is misleading since this isn't an I/O operation. Consider defining a domain-specific error enum or custom error type to clearly represent parsing errors.
) -> Result<leetcoderustapi::ProgrammingLanguage, std::io::Error> {

src/utils.rs:166

  • The new prompt_for_language logic isn't covered by existing tests. Consider adding unit or integration tests to validate input handling and retry behavior.
pub fn prompt_for_language(

Signed-off-by: dfayd0 <78728332+dfayd0@users.noreply.github.com>
@dfayd0 dfayd0 merged commit 7b772dd into main Jul 12, 2025
@dfayd0 dfayd0 deleted the 16-add-default_language-re-prompt-if-not-found-for-a-given-problem branch July 12, 2025 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add language re-prompt if not found for a given problem

2 participants