mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Sends cwd info for runnables and code lenses
This commit is contained in:
parent
3507bcb97a
commit
7c7cfc5f04
8 changed files with 38 additions and 5 deletions
|
@ -255,6 +255,18 @@ impl ProjectWorkspace {
|
|||
}
|
||||
crate_graph
|
||||
}
|
||||
|
||||
pub fn workspace_root_for(&self, path: &Path) -> Option<&Path> {
|
||||
match self {
|
||||
ProjectWorkspace::Cargo { cargo, .. } => {
|
||||
Some(cargo.workspace_root.as_ref()).filter(|root| path.starts_with(root))
|
||||
}
|
||||
ProjectWorkspace::Json { project: JsonProject { roots, .. } } => roots
|
||||
.iter()
|
||||
.find(|root| path.starts_with(&root.path))
|
||||
.map(|root| root.path.as_ref()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn find_rust_project_json(path: &Path) -> Option<PathBuf> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue