Skip to content

Commit bde945b

Browse files
authored
fix(workspace_db): The file biome.json does not exist in the workspace (#10774)
1 parent 6232fcd commit bde945b

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

.changeset/young-groups-rule.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@biomejs/biome": patch
3+
---
4+
5+
Fixed [#10268](https://github.com/biomejs/biome/issues/10268) where a race condition resulted in internal errors such as: `The file biome.json does not exist in the workspace`.

crates/biome_workspace_db/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ impl WorkspaceDb {
4141
pub fn insert_source(&mut self, document_file_source: DocumentFileSource) -> usize {
4242
self.file_sources
4343
.iter()
44-
.position(|(_, file_source)| *file_source == document_file_source)
45-
.unwrap_or_else(|| self.file_sources.push(document_file_source))
44+
.find(|(_, file_source)| **file_source == document_file_source)
45+
.map_or_else(
46+
|| self.file_sources.push(document_file_source),
47+
|(index, _)| index,
48+
)
4649
}
4750

4851
pub fn insert_file(&mut self, path: &Utf8Path, file: ParsedSource) {

0 commit comments

Comments
 (0)