Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion yoshi-deluxe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ syn = { version = "2.0.101", features = [
"extra-traits",
] }
quote = "1.0.40"
proc-macro2 = "1.0.95"
proc-macro2 = { version = "1.0", features = ["span-locations"] }

# HTTP client for docs scraping
reqwest = { version = "0.12.19", features = [
Expand Down
20 changes: 16 additions & 4 deletions yoshi-deluxe/src/errors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,9 +719,9 @@ pub mod recovery {
use super::*;

/// Attempt automatic error recovery
pub async fn attempt_recovery<T, F, Fut>(operation: F, max_retries: usize) -> Result<T>
pub async fn attempt_recovery<T, F, Fut>(mut operation: F, max_retries: usize) -> Result<T>
where
F: Fn() -> Fut,
F: FnMut() -> Fut,
Fut: std::future::Future<Output = Result<T>>,
{
let mut last_error = None;
Expand Down Expand Up @@ -749,12 +749,12 @@ pub mod recovery {

/// Retry operation with specific error patterns
pub async fn retry_on_pattern<T, F, Fut>(
operation: F,
mut operation: F,
max_retries: usize,
retry_patterns: &[&str],
) -> Result<T>
where
F: Fn() -> Fut,
F: FnMut() -> Fut,
Fut: std::future::Future<Output = Result<T>>,
{
for attempt in 0..=max_retries {
Expand All @@ -780,6 +780,18 @@ pub mod recovery {
}
}

impl From<syn::Error> for Yoshi {
fn from(err: syn::Error) -> Self {
Yoshi::new(YoshiKind::Syntax, err.to_string())
}
}

impl From<reqwest::Error> for Yoshi {
fn from(err: reqwest::Error) -> Self {
Yoshi::new(YoshiKind::Network, err.to_string())
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
16 changes: 8 additions & 8 deletions yoshi-deluxe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,20 @@ pub mod types;
// Re-export core types and functionality
pub use ast::{ASTAnalysisEngine, ASTContext, NodeInfo, NodeType, SurroundingContext};
pub use codegen::CodeGenerationEngine;
pub use types::{CorrectionProposal, CorrectionStrategy, SafetyLevel};
pub use constants::*;
pub use diagnostics::CompilerDiagnosticProcessor;
pub use docs::{DocsScrapingEngine, MethodSuggestion};
pub use docs::DocsScrapingEngine;
pub use errors::{AutoCorrectionError, Result};
pub use metrics::{SystemMetrics, SystemMetricsSnapshot};
pub use system::{AutoCorrectionSystem, SystemConfig};
pub use types::*;
pub use system::AutoCorrectionSystem;
pub use types::{
CorrectionProposal, CorrectionStrategy, MethodSuggestion, SafetyLevel, SystemConfig,
};

// Re-export yoshi-std types for convenience
use std::collections::HashMap;
pub use yoshi_std::{Hatch, Result as YoshiResult, Yoshi, YoshiKind};
use yoshi_std::LayText;
use yoshi_std::{Hatchable, LayText};

//--------------------------------------------------------------------------------------------------
// Public API Convenience Functions
Expand Down Expand Up @@ -213,10 +215,10 @@ pub struct SystemCapabilities {
#[cfg(test)]
mod integration_tests {
use super::*;
use yoshi_std::LayText;
use std::path::PathBuf;
use tempfile::TempDir;
use tokio::fs;
use yoshi_std::LayText;

async fn create_test_project() -> Result<TempDir> {
let temp_dir = tempfile::tempdir()
Expand Down Expand Up @@ -587,8 +589,6 @@ pub mod benchmarks {
// Module Implementation Files
//==================================================================================================



//--------------------------------------------------------------------------------------------------
// System Health and Monitoring
//--------------------------------------------------------------------------------------------------
Expand Down