mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Automatically reload project info on Cargo.toml changes
This commit is contained in:
parent
5fa8f8e376
commit
d0a8f6a3eb
7 changed files with 57 additions and 28 deletions
|
@ -24,7 +24,7 @@ use rustc_hash::FxHashMap;
|
|||
///
|
||||
/// We use absolute paths here, `cargo metadata` guarantees to always produce
|
||||
/// abs paths.
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct CargoWorkspace {
|
||||
packages: Arena<PackageData>,
|
||||
targets: Arena<TargetData>,
|
||||
|
@ -68,7 +68,7 @@ pub type Package = Idx<PackageData>;
|
|||
|
||||
pub type Target = Idx<TargetData>;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct PackageData {
|
||||
pub version: String,
|
||||
pub name: String,
|
||||
|
@ -83,13 +83,13 @@ pub struct PackageData {
|
|||
pub proc_macro_dylib_path: Option<AbsPathBuf>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct PackageDependency {
|
||||
pub pkg: Package,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct TargetData {
|
||||
pub package: Package,
|
||||
pub name: String,
|
||||
|
|
|
@ -24,7 +24,7 @@ pub use crate::{
|
|||
};
|
||||
pub use ra_proc_macro::ProcMacroClient;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub enum ProjectWorkspace {
|
||||
/// Project workspace was discovered by running `cargo metadata` and `rustc --print sysroot`.
|
||||
Cargo { cargo: CargoWorkspace, sysroot: Sysroot },
|
||||
|
|
|
@ -3,19 +3,19 @@
|
|||
use std::{convert::TryFrom, env, ops, path::Path, process::Command};
|
||||
|
||||
use anyhow::{bail, format_err, Result};
|
||||
use paths::{AbsPath, AbsPathBuf};
|
||||
use ra_arena::{Arena, Idx};
|
||||
|
||||
use crate::output;
|
||||
use paths::{AbsPath, AbsPathBuf};
|
||||
|
||||
#[derive(Default, Debug, Clone)]
|
||||
#[derive(Default, Debug, Clone, Eq, PartialEq)]
|
||||
pub struct Sysroot {
|
||||
crates: Arena<SysrootCrateData>,
|
||||
}
|
||||
|
||||
pub type SysrootCrate = Idx<SysrootCrateData>;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct SysrootCrateData {
|
||||
pub name: String,
|
||||
pub root: AbsPathBuf,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue