10841: Emit moniker in lsif r=Veykril a=HKalbasi

fix #10559 

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
Co-authored-by: HKalbasi <45197576+HKalbasi@users.noreply.github.com>
This commit is contained in:
bors[bot] 2021-11-29 11:13:39 +00:00 committed by GitHub
commit 393cbd0982
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 511 additions and 19 deletions

View file

@ -130,6 +130,8 @@ pub struct PackageData {
pub version: semver::Version,
/// Name as given in the `Cargo.toml`
pub name: String,
/// Repository as given in the `Cargo.toml`
pub repository: Option<String>,
/// Path containing the `Cargo.toml`
pub manifest: ManifestPath,
/// Targets provided by the crate (lib, bin, example, test, ...)
@ -146,9 +148,9 @@ pub struct PackageData {
pub features: FxHashMap<String, Vec<String>>,
/// List of features enabled on this package
pub active_features: Vec<String>,
// String representation of package id
/// String representation of package id
pub id: String,
// The contents of [package.metadata.rust-analyzer]
/// The contents of [package.metadata.rust-analyzer]
pub metadata: RustAnalyzerPackageMetaData,
}
@ -302,7 +304,14 @@ impl CargoWorkspace {
meta.packages.sort_by(|a, b| a.id.cmp(&b.id));
for meta_pkg in &meta.packages {
let cargo_metadata::Package {
id, edition, name, manifest_path, version, metadata, ..
id,
edition,
name,
manifest_path,
version,
metadata,
repository,
..
} = meta_pkg;
let meta = from_value::<PackageMetadata>(metadata.clone()).unwrap_or_default();
let edition = edition.parse::<Edition>().unwrap_or_else(|err| {
@ -323,6 +332,7 @@ impl CargoWorkspace {
is_local,
is_member,
edition,
repository: repository.clone(),
dependencies: Vec::new(),
features: meta_pkg.features.clone().into_iter().collect(),
active_features: Vec::new(),