mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 21:13:37 +00:00
Allow rust-project.json to be hidden
This commit is contained in:
parent
b23142209e
commit
2426649661
3 changed files with 14 additions and 2 deletions
|
@ -68,6 +68,9 @@ impl ProjectManifest {
|
||||||
if path.file_name().unwrap_or_default() == "rust-project.json" {
|
if path.file_name().unwrap_or_default() == "rust-project.json" {
|
||||||
return Ok(ProjectManifest::ProjectJson(path));
|
return Ok(ProjectManifest::ProjectJson(path));
|
||||||
}
|
}
|
||||||
|
if path.file_name().unwrap_or_default() == ".rust-project.json" {
|
||||||
|
return Ok(ProjectManifest::ProjectJson(path));
|
||||||
|
}
|
||||||
if path.file_name().unwrap_or_default() == "Cargo.toml" {
|
if path.file_name().unwrap_or_default() == "Cargo.toml" {
|
||||||
return Ok(ProjectManifest::CargoToml(path));
|
return Ok(ProjectManifest::CargoToml(path));
|
||||||
}
|
}
|
||||||
|
@ -94,6 +97,9 @@ impl ProjectManifest {
|
||||||
if let Some(project_json) = find_in_parent_dirs(path, "rust-project.json") {
|
if let Some(project_json) = find_in_parent_dirs(path, "rust-project.json") {
|
||||||
return Ok(vec![ProjectManifest::ProjectJson(project_json)]);
|
return Ok(vec![ProjectManifest::ProjectJson(project_json)]);
|
||||||
}
|
}
|
||||||
|
if let Some(project_json) = find_in_parent_dirs(path, ".rust-project.json") {
|
||||||
|
return Ok(vec![ProjectManifest::ProjectJson(project_json)]);
|
||||||
|
}
|
||||||
return find_cargo_toml(path)
|
return find_cargo_toml(path)
|
||||||
.map(|paths| paths.into_iter().map(ProjectManifest::CargoToml).collect());
|
.map(|paths| paths.into_iter().map(ProjectManifest::CargoToml).collect());
|
||||||
|
|
||||||
|
|
|
@ -750,7 +750,7 @@ fn test_missing_module_code_action_in_json_project() {
|
||||||
|
|
||||||
let code = format!(
|
let code = format!(
|
||||||
r#"
|
r#"
|
||||||
//- /rust-project.json
|
//- /.rust-project.json
|
||||||
{project}
|
{project}
|
||||||
|
|
||||||
//- /src/lib.rs
|
//- /src/lib.rs
|
||||||
|
|
|
@ -71,7 +71,9 @@
|
||||||
"workspaceContains:Cargo.toml",
|
"workspaceContains:Cargo.toml",
|
||||||
"workspaceContains:*/Cargo.toml",
|
"workspaceContains:*/Cargo.toml",
|
||||||
"workspaceContains:rust-project.json",
|
"workspaceContains:rust-project.json",
|
||||||
"workspaceContains:*/rust-project.json"
|
"workspaceContains:*/rust-project.json",
|
||||||
|
"workspaceContains:.rust-project.json",
|
||||||
|
"workspaceContains:*/.rust-project.json"
|
||||||
],
|
],
|
||||||
"main": "./out/main",
|
"main": "./out/main",
|
||||||
"contributes": {
|
"contributes": {
|
||||||
|
@ -3211,6 +3213,10 @@
|
||||||
{
|
{
|
||||||
"fileMatch": "rust-project.json",
|
"fileMatch": "rust-project.json",
|
||||||
"url": "https://json.schemastore.org/rust-project.json"
|
"url": "https://json.schemastore.org/rust-project.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fileMatch": ".rust-project.json",
|
||||||
|
"url": "https://json.schemastore.org/rust-project.json"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"walkthroughs": [
|
"walkthroughs": [
|
||||||
|
|
Loading…
Reference in a new issue