Skip to content

Commit ddcd66b

Browse files
committed
Auto merge of #17818 - alibektas:hidden_rust_project_json, r=Veykril
Allow rust-project.json to be hidden Closes #17816
2 parents b231422 + 2426649 commit ddcd66b

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

crates/project-model/src/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ impl ProjectManifest {
6868
if path.file_name().unwrap_or_default() == "rust-project.json" {
6969
return Ok(ProjectManifest::ProjectJson(path));
7070
}
71+
if path.file_name().unwrap_or_default() == ".rust-project.json" {
72+
return Ok(ProjectManifest::ProjectJson(path));
73+
}
7174
if path.file_name().unwrap_or_default() == "Cargo.toml" {
7275
return Ok(ProjectManifest::CargoToml(path));
7376
}
@@ -94,6 +97,9 @@ impl ProjectManifest {
9497
if let Some(project_json) = find_in_parent_dirs(path, "rust-project.json") {
9598
return Ok(vec![ProjectManifest::ProjectJson(project_json)]);
9699
}
100+
if let Some(project_json) = find_in_parent_dirs(path, ".rust-project.json") {
101+
return Ok(vec![ProjectManifest::ProjectJson(project_json)]);
102+
}
97103
return find_cargo_toml(path)
98104
.map(|paths| paths.into_iter().map(ProjectManifest::CargoToml).collect());
99105

crates/rust-analyzer/tests/slow-tests/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ fn test_missing_module_code_action_in_json_project() {
750750

751751
let code = format!(
752752
r#"
753-
//- /rust-project.json
753+
//- /.rust-project.json
754754
{project}
755755
756756
//- /src/lib.rs

editors/code/package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@
7171
"workspaceContains:Cargo.toml",
7272
"workspaceContains:*/Cargo.toml",
7373
"workspaceContains:rust-project.json",
74-
"workspaceContains:*/rust-project.json"
74+
"workspaceContains:*/rust-project.json",
75+
"workspaceContains:.rust-project.json",
76+
"workspaceContains:*/.rust-project.json"
7577
],
7678
"main": "./out/main",
7779
"contributes": {
@@ -3211,6 +3213,10 @@
32113213
{
32123214
"fileMatch": "rust-project.json",
32133215
"url": "https://json.schemastore.org/rust-project.json"
3216+
},
3217+
{
3218+
"fileMatch": ".rust-project.json",
3219+
"url": "https://json.schemastore.org/rust-project.json"
32143220
}
32153221
],
32163222
"walkthroughs": [

0 commit comments

Comments
 (0)