дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 11:15:40 +02:00
Cargo.toml had no way to tell that a dependency had a newer release.
Dependencies in [dependencies], [dev-dependencies], [build-dependencies], target tables and [workspace.dependencies] now get a weak warning when the newest stable release is outside the version requirement, with a quick fix that rewrites the requirement at its original precision ("0.7" → "0.10") in both string and inline-table forms. Versions complete inside the version string, newest first, without yanked releases. Path, git and workspace-inherited dependencies are skipped, prereleases are only suggested to prerelease requirements, and failures stay silent.
Versions come from the crates.io sparse index through the backend's HTTP client, with an in-memory and on-disk cache and coalesced requests, behind a dependency version source shared by file-type parsers so other manifests can be added later. semver is now used directly; it was already linked into the app.
Fixes #479
42 рядки
1.3 KiB
Rust
42 рядки
1.3 KiB
Rust
//! Manifest dependencies and repository versions, independent of editor and transport.
|
|
mod cache;
|
|
pub mod cargo;
|
|
|
|
pub use cache::VersionCache;
|
|
use ide_core::{CancellationToken, IdeResult};
|
|
use serde::{Deserialize, Serialize};
|
|
use specta::Type;
|
|
|
|
/// A repository adapter; Maven/npm can use the same cache and editor protocol.
|
|
pub trait DependencyVersionSource: Send + Sync {
|
|
/// A filesystem-safe, stable repository identifier.
|
|
fn id(&self) -> &'static str;
|
|
/// Non-yanked versions in descending semantic order.
|
|
fn fetch(&self, package: &str, cancel: &CancellationToken) -> IdeResult<Vec<String>>;
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, Type)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct DependencyUpdate {
|
|
pub latest: String,
|
|
pub replacement: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, Type)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct ManifestDependency {
|
|
pub package: String,
|
|
pub requirement: String,
|
|
/// UTF-16 offsets of the string's contents (quotes excluded).
|
|
pub from: u32,
|
|
pub to: u32,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize, Type)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct DependencyVersions {
|
|
pub dependency: ManifestDependency,
|
|
pub versions: Vec<String>,
|
|
pub update: Option<DependencyUpdate>,
|
|
}
|