refactor(core): move db outside workspace#10796
Conversation
🦋 Changeset detectedLatest commit: 611f707 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Organic activityNo automation signals detected in the analyzed events. This is an automated analysis by AgentScan |
Merging this PR will degrade performance by 23.56%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
4cfb37e to
5ce0fa0
Compare
WalkthroughThis PR refactors the Biome Language Server's workspace database access by introducing Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/biome_lsp/src/requests/syntax_tree.rs (1)
26-35: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winWrap
syntax_tree_requestwithcatch_lsp_operationincrates/biome_lsp/src/server.rs. This custom RPC still bypasses the cancellation handling used by the workspace methods, so asalsa::Cancelledhere can surface as a panic instead of an LSP cancellation error.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/biome_lsp/src/requests/syntax_tree.rs` around lines 26 - 35, Wrap the custom RPC handled by syntax_tree_request in catch_lsp_operation from server.rs so cancellations are converted into proper LSP cancellation errors instead of panicking; update the request handling path around syntax_tree_request and its call site in the server request dispatch to use the same cancellation wrapper as the workspace methods.
🧹 Nitpick comments (3)
crates/biome_service/src/workspace/db.rs (1)
33-38: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument why
lsp()uses owned storage.This constructor encodes the LSP cancellation/update semantics. A short rustdoc note would make the shared-vs-owned split less cryptic.
As per coding guidelines, “Use rustdoc documentation for documenting new features, rule changes, and rule/assist options in Rust code.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/biome_service/src/workspace/db.rs` around lines 33 - 38, Add a short rustdoc comment on the WorkspaceDb::lsp constructor explaining that it intentionally uses DbStorage::Owned with a Mutex because the LSP path needs isolated cancellation/update semantics, and contrast it briefly with the shared-storage case so the owned-vs-shared split is clear to readers.Source: Coding guidelines
crates/biome_service/src/workspace/server.rs (1)
162-166: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winComplete the
WorkspaceServerWithDbrustdoc.The comment currently trails off at “A reference to”. Please describe that it borrows a
WorkspaceServerplusDbStatefor DB-backed workspace operations.As per coding guidelines, “Use rustdoc documentation for documenting new features, rule changes, and rule/assist options in Rust code.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/biome_service/src/workspace/server.rs` around lines 162 - 166, The rustdoc for WorkspaceServerWithDb is incomplete and trails off at “A reference to”; update the documentation on the WorkspaceServerWithDb struct to clearly describe that it borrows both a WorkspaceServer and a db::DbState for DB-backed workspace operations. Keep the comment concise and aligned with the surrounding rustdoc style so readers understand the role of this wrapper type immediately.Source: Coding guidelines
crates/biome_workspace_db/src/lib.rs (1)
20-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd rustdoc for the update-mode contract.
ReplacevsSettersis now a public and subtle Salsa contract; please document when each mode is safe to use.Suggested shape
+/// Controls how an existing [`ParsedSource`] is refreshed in the workspace DB. pub enum ParsedSourceUpdateMode { + /// Replaces the stored input with a new Salsa input identity. Replace, + /// Updates the existing Salsa input through setters, preserving identity. Setters, }As per coding guidelines, “Use rustdoc documentation for documenting new features, rule changes, and rule/assist options in Rust code.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/biome_workspace_db/src/lib.rs` around lines 20 - 24, Add rustdoc to ParsedSourceUpdateMode so the public Salsa update-mode contract is clear. Document in ParsedSourceUpdateMode::Replace and ParsedSourceUpdateMode::Setters when each mode is safe to use, especially the distinction between replacing the full parsed source versus applying setter-style updates. Keep the docs on the enum and its variants concise but explicit so callers of ParsedSourceUpdateMode understand the intended invariants and usage.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/biome_cli/src/commands/clean.rs`:
- Around line 10-13: The clean command currently fails when the log directory is
already missing because `remove_dir_all` returns `NotFound` and the flow still
aborts; update `clean` in `commands::clean` to treat that case as harmless, then
recreate the logs directory using `create_dir_all` instead of `create_dir` so
nested paths are restored correctly. Keep the fix localized around the
`logs_path` cleanup/recreation logic and preserve the existing behavior for
other errors.
In `@crates/biome_lsp/src/server.rs`:
- Line 538: The `handle_code_action` flow in `server.rs` is re-wrapping an
already valid `Result<CodeAction, LspError>` by calling
`map_err(into_lsp_error)` on `action`, which replaces intentional handler
`LspError` values with a generic internal error. Update the `Ok(Ok(action))`
branch to return the handler’s original `LspError` unchanged, and only use
`into_lsp_error` for unexpected errors coming from the outer layers of the
request handling path.
In `@crates/biome_lsp/src/session.rs`:
- Around line 1343-1353: In session.rs, the scan kind selection logic in the
code path using ProjectScanComputer::new(...).compute() and
scan_kind_from_editor_features() reads the editor-derived scan kind twice, which
can race with a settings update and produce inconsistent branching. Cache the
result of scan_kind_from_editor_features() once before the if/else chain, then
use that single value for both the check and the returned fallback so the chosen
ScanKind stays consistent.
---
Outside diff comments:
In `@crates/biome_lsp/src/requests/syntax_tree.rs`:
- Around line 26-35: Wrap the custom RPC handled by syntax_tree_request in
catch_lsp_operation from server.rs so cancellations are converted into proper
LSP cancellation errors instead of panicking; update the request handling path
around syntax_tree_request and its call site in the server request dispatch to
use the same cancellation wrapper as the workspace methods.
---
Nitpick comments:
In `@crates/biome_service/src/workspace/db.rs`:
- Around line 33-38: Add a short rustdoc comment on the WorkspaceDb::lsp
constructor explaining that it intentionally uses DbStorage::Owned with a Mutex
because the LSP path needs isolated cancellation/update semantics, and contrast
it briefly with the shared-storage case so the owned-vs-shared split is clear to
readers.
In `@crates/biome_service/src/workspace/server.rs`:
- Around line 162-166: The rustdoc for WorkspaceServerWithDb is incomplete and
trails off at “A reference to”; update the documentation on the
WorkspaceServerWithDb struct to clearly describe that it borrows both a
WorkspaceServer and a db::DbState for DB-backed workspace operations. Keep the
comment concise and aligned with the surrounding rustdoc style so readers
understand the role of this wrapper type immediately.
In `@crates/biome_workspace_db/src/lib.rs`:
- Around line 20-24: Add rustdoc to ParsedSourceUpdateMode so the public Salsa
update-mode contract is clear. Document in ParsedSourceUpdateMode::Replace and
ParsedSourceUpdateMode::Setters when each mode is safe to use, especially the
distinction between replacing the full parsed source versus applying
setter-style updates. Keep the docs on the enum and its variants concise but
explicit so callers of ParsedSourceUpdateMode understand the intended invariants
and usage.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b3998929-dc66-4d2d-b5d0-7bbe696d8388
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lockand included by**
📒 Files selected for processing (27)
.changeset/chubby-nails-invent.md.changeset/tiny-emus-matter.mdcrates/biome_cli/src/commands/clean.rscrates/biome_cli/src/commands/daemon.rscrates/biome_cli/tests/main.rscrates/biome_css_analyze/src/lib.rscrates/biome_html_analyze/src/lib.rscrates/biome_js_analyze/src/lib.rscrates/biome_lsp/Cargo.tomlcrates/biome_lsp/src/handlers/analysis.rscrates/biome_lsp/src/handlers/formatting.rscrates/biome_lsp/src/handlers/navigation.rscrates/biome_lsp/src/handlers/text_document.rscrates/biome_lsp/src/requests/syntax_tree.rscrates/biome_lsp/src/server.rscrates/biome_lsp/src/server.tests.rscrates/biome_lsp/src/server_goto.tests.rscrates/biome_lsp/src/session.rscrates/biome_lsp/src/utils.rscrates/biome_service/Cargo.tomlcrates/biome_service/src/lib.rscrates/biome_service/src/test_utils.rscrates/biome_service/src/workspace.rscrates/biome_service/src/workspace/db.rscrates/biome_service/src/workspace/server.rscrates/biome_workspace_db/Cargo.tomlcrates/biome_workspace_db/src/lib.rs
| let logs_path = biome_env() | ||
| .value_for("BIOME_LOG_PATH") | ||
| .map_or(default_biome_log_path(), Utf8PathBuf::from); | ||
| remove_dir_all(logs_path.clone()).and_then(|_| create_dir(logs_path))?; | ||
| remove_dir_all(logs_path.clone()).and_then(|_| create_dir(logs_path.clone()))?; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Handle a missing log directory gracefully.
Line 13 still bails out on NotFound, so biome clean fails on a fresh machine or after the logs folder has already been removed. Ignore that case and recreate the directory with create_dir_all instead. Tiny fix, less drama.
Possible fix
use biome_console::{ConsoleExt, markup};
use biome_flags::biome_env;
use camino::Utf8PathBuf;
-use std::fs::{create_dir, remove_dir_all};
+use std::fs::{create_dir_all, remove_dir_all};
+use std::io::ErrorKind;
@@
let logs_path = biome_env()
.value_for("BIOME_LOG_PATH")
.map_or(default_biome_log_path(), Utf8PathBuf::from);
- remove_dir_all(logs_path.clone()).and_then(|_| create_dir(logs_path.clone()))?;
+ match remove_dir_all(&logs_path) {
+ Ok(()) => {}
+ Err(err) if err.kind() == ErrorKind::NotFound => {}
+ Err(err) => return Err(err.into()),
+ }
+ create_dir_all(&logs_path)?;
let console = cli_session.app.console;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| let logs_path = biome_env() | |
| .value_for("BIOME_LOG_PATH") | |
| .map_or(default_biome_log_path(), Utf8PathBuf::from); | |
| remove_dir_all(logs_path.clone()).and_then(|_| create_dir(logs_path))?; | |
| remove_dir_all(logs_path.clone()).and_then(|_| create_dir(logs_path.clone()))?; | |
| let logs_path = biome_env() | |
| .value_for("BIOME_LOG_PATH") | |
| .map_or(default_biome_log_path(), Utf8PathBuf::from); | |
| match remove_dir_all(&logs_path) { | |
| Ok(()) => {} | |
| Err(err) if err.kind() == ErrorKind::NotFound => {} | |
| Err(err) => return Err(err.into()), | |
| } | |
| create_dir_all(&logs_path)?; |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/biome_cli/src/commands/clean.rs` around lines 10 - 13, The clean
command currently fails when the log directory is already missing because
`remove_dir_all` returns `NotFound` and the flow still aborts; update `clean` in
`commands::clean` to treat that case as harmless, then recreate the logs
directory using `create_dir_all` instead of `create_dir` so nested paths are
restored correctly. Keep the fix localized around the `logs_path`
cleanup/recreation logic and preserve the existing behavior for other errors.
| Ok(action) => Ok(action), | ||
| Err(err) => Err(into_lsp_error(err)), | ||
| }, | ||
| Ok(Ok(action)) => action.map_err(into_lsp_error), |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Preserve the handler’s original LspError.
Line 538 already has a Result<CodeAction, LspError>. Running it through map_err(into_lsp_error) rewrites every intentional protocol error into a fresh internal error, so clients lose the original code/message/data.
Suggested fix
- Ok(Ok(action)) => action.map_err(into_lsp_error),
+ Ok(Ok(action)) => action,📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Ok(Ok(action)) => action.map_err(into_lsp_error), | |
| Ok(Ok(action)) => action, |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/biome_lsp/src/server.rs` at line 538, The `handle_code_action` flow in
`server.rs` is re-wrapping an already valid `Result<CodeAction, LspError>` by
calling `map_err(into_lsp_error)` on `action`, which replaces intentional
handler `LspError` values with a generic internal error. Update the
`Ok(Ok(action))` branch to return the handler’s original `LspError` unchanged,
and only use `into_lsp_error` for unexpected errors coming from the outer layers
of the request handling path.
| let scan_kind = ProjectScanComputer::new(&configuration).compute(); | ||
| // We give the editor priority | ||
| let scan_kind = if !self.scan_kind_from_editor_features().is_none() { | ||
| // We give priority to the scan kind requested by the user. | ||
| let scan_kind = if scan_kind.is_project() || scan_kind.is_type_aware() { | ||
| scan_kind | ||
| } else if !self.scan_kind_from_editor_features().is_none() { | ||
| self.scan_kind_from_editor_features() | ||
| } else if scan_kind.is_none() { | ||
| ScanKind::KnownFiles | ||
| } else { | ||
| scan_kind | ||
| }; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Read the editor scan kind once.
scan_kind_from_editor_features() is called twice, so a concurrent settings update could make the branch test and returned value disagree. Cache it before the if.
Proposed fix
let scan_kind = ProjectScanComputer::new(&configuration).compute();
+let editor_scan_kind = self.scan_kind_from_editor_features();
// We give priority to the scan kind requested by the user.
let scan_kind = if scan_kind.is_project() || scan_kind.is_type_aware() {
scan_kind
-} else if !self.scan_kind_from_editor_features().is_none() {
- self.scan_kind_from_editor_features()
+} else if !editor_scan_kind.is_none() {
+ editor_scan_kind
} else if scan_kind.is_none() {
ScanKind::KnownFiles
} else {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| let scan_kind = ProjectScanComputer::new(&configuration).compute(); | |
| // We give the editor priority | |
| let scan_kind = if !self.scan_kind_from_editor_features().is_none() { | |
| // We give priority to the scan kind requested by the user. | |
| let scan_kind = if scan_kind.is_project() || scan_kind.is_type_aware() { | |
| scan_kind | |
| } else if !self.scan_kind_from_editor_features().is_none() { | |
| self.scan_kind_from_editor_features() | |
| } else if scan_kind.is_none() { | |
| ScanKind::KnownFiles | |
| } else { | |
| scan_kind | |
| }; | |
| let scan_kind = ProjectScanComputer::new(&configuration).compute(); | |
| let editor_scan_kind = self.scan_kind_from_editor_features(); | |
| // We give priority to the scan kind requested by the user. | |
| let scan_kind = if scan_kind.is_project() || scan_kind.is_type_aware() { | |
| scan_kind | |
| } else if !editor_scan_kind.is_none() { | |
| editor_scan_kind | |
| } else if scan_kind.is_none() { | |
| ScanKind::KnownFiles | |
| } else { | |
| scan_kind | |
| }; |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/biome_lsp/src/session.rs` around lines 1343 - 1353, In session.rs, the
scan kind selection logic in the code path using
ProjectScanComputer::new(...).compute() and scan_kind_from_editor_features()
reads the editor-derived scan kind twice, which can race with a settings update
and produce inconsistent branching. Cache the result of
scan_kind_from_editor_features() once before the if/else chain, then use that
single value for both the check and the returned fallback so the chosen ScanKind
stays consistent.
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@biomejs/biome](https://biomejs.dev) ([source](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome)) | imports | patch | [`2.5.1` -> `2.5.2`](https://renovatebot.com/diffs/npm/@biomejs%2fbiome/2.5.1/2.5.2) | --- ### Release Notes <details> <summary>biomejs/biome (@​biomejs/biome)</summary> ### [`v2.5.2`](https://github.com/biomejs/biome/blob/HEAD/packages/@​biomejs/biome/CHANGELOG.md#252) [Compare Source](https://github.com/biomejs/biome/compare/@biomejs/biome@2.5.1...@biomejs/biome@2.5.2) ##### Patch Changes - [#​10595](biomejs/biome#10595) [`f458028`](biomejs/biome@f458028) Thanks [@​pkallos](https://github.com/pkallos)! - Added the option `ignoreBooleanCoercion` to [useNullishCoalescing](https://biomejs.dev/linter/rules/use-nullish-coalescing/). When enabled, Biome ignores `||` and `||=` used inside a `Boolean()` call, where coalescing on falsy values is intentional. - [#​10798](biomejs/biome#10798) [`4a32b63`](biomejs/biome@4a32b63) Thanks [@​pkallos](https://github.com/pkallos)! - Added the option `ignorePrimitives` to [useNullishCoalescing](https://biomejs.dev/linter/rules/use-nullish-coalescing/). When enabled, Biome ignores `||`, `||=`, and ternary expressions whose non-nullish operands are all primitives the option opts out of. Use `true` to ignore all primitives, or an object selecting `string`, `number`, `boolean`, or `bigint`. - [#​10545](biomejs/biome#10545) [`f3d4c00`](biomejs/biome@f3d4c00) Thanks [@​Mokto](https://github.com/Mokto)! - Added the new nursery rule [`noSvelteUnnecessaryStateWrap`](https://biomejs.dev/linter/rules/no-svelte-unnecessary-state-wrap/), which reports unnecessary `$state()` wrapping of classes from `svelte/reactivity` that are already reactive. ```svelte <script> import { SvelteMap } from "svelte/reactivity"; const map = $state(new SvelteMap()); // redundant </script> ``` - [#​10752](biomejs/biome#10752) [`f62fb8b`](biomejs/biome@f62fb8b) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed [#​10739](biomejs/biome#10739). Now the rule [`useValidAutocomplete`](https://biomejs.dev/linter/rules/use-valid-autocomplete/) correctly flags the `autoComplete` attribute. - [#​10796](biomejs/biome#10796) [`f1b3ab2`](biomejs/biome@f1b3ab2) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed [#​10768](biomejs/biome#10768). Improved the performance of the Biome Language Server by cancelling certain in-flight operations when there are fast updates. - [#​10719](biomejs/biome#10719) [`aa649b5`](biomejs/biome@aa649b5) Thanks [@​minseong0324](https://github.com/minseong0324)! - Fixed [`noMisleadingReturnType`](https://biomejs.dev/linter/rules/no-misleading-return-type/) false positive on returns that use a widening type assertion: `"a" as string` is no longer reported as misleading. The rule now also reports a literal-pinning assertion such as `false as false`, matching the existing `as const` behavior. ```ts // No longer flagged (returns are `string`): function getValue(b: boolean): string { if (b) return "a" as string; return "b" as string; } // Now also reported, like `as const` (returns `false`): function isReady(): boolean { return false as false; } ``` - [#​10678](biomejs/biome#10678) [`8f073a7`](biomejs/biome@8f073a7) Thanks [@​PranavAchar01](https://github.com/PranavAchar01)! - Fixed [#​7718](biomejs/biome#7718): Biome now correctly parses CSS nesting selectors when `&` appears as a trailing sub-selector after a type selector, e.g. `h1& { color: red; }`. - [#​10756](biomejs/biome#10756) [`5ec965a`](biomejs/biome@5ec965a) Thanks [@​denbezrukov](https://github.com/denbezrukov)! - Fixed CSS formatter output for selector lists with `allowWrongLineComments` and `//` comments after a selector comma. Biome now keeps the selector before the line comment inline instead of breaking it across descendant combinators. ```diff -.powerPathNavigator - .helm - button.pressedButton, // pressed +.powerPathNavigator .helm button.pressedButton, // pressed .powerPathNavigator .helm button:active:not(.disabledButton) { } ``` - [#​10757](biomejs/biome#10757) [`6232fcd`](biomejs/biome@6232fcd) Thanks [@​PranavAchar01](https://github.com/PranavAchar01)! - Fixed [#​8269](biomejs/biome#8269): the CSS parser now accepts Tailwind `@variant` and `@utility` names that start with a digit, such as the `2xl` breakpoint. ```css @​utility container { @​variant 2xl { max-width: 1400px; } } ``` - [#​10777](biomejs/biome#10777) [`575ced6`](biomejs/biome@575ced6) Thanks [@​WaterWhisperer](https://github.com/WaterWhisperer)! - Fixed an issue reported in [#​10708](biomejs/biome#10708): the GitLab reporter now handles `--verbose` diagnostics filtering correctly. - [#​10281](biomejs/biome#10281) [`0efe244`](biomejs/biome@0efe244) Thanks [@​Zelys-DFKH](https://github.com/Zelys-DFKH)! - Fixed a bug where GritQL patterns rejected positional (unkeyed) arguments. - [#​10758](biomejs/biome#10758) [`e36fd8a`](biomejs/biome@e36fd8a) Thanks [@​henrybrewer00-dotcom](https://github.com/henrybrewer00-dotcom)! - Fixed [#​10697](biomejs/biome#10697): The formatter no longer removes the parentheses around an `await` or `yield` expression used as the target of a TypeScript instantiation expression. For example, `(await makeFactory)<Value>` is no longer reformatted to `await makeFactory<Value>`, which would change the meaning of the code. - [#​10586](biomejs/biome#10586) [`3617094`](biomejs/biome@3617094) Thanks [@​IxxyDev](https://github.com/IxxyDev)! - Fixed [#​9568](biomejs/biome#9568): [`noFloatingPromises`](https://biomejs.dev/linter/rules/no-floating-promises/) no longer reports a false positive when calling an overloaded function and the selected overload does not return a promise. ```ts function bestEffort(cb: () => Promise<number>): Promise<number>; function bestEffort(cb: () => number): number; function bestEffort( cb: () => number | Promise<number>, ): Promise<number> | number { return cb() as Promise<number> | number; } // This resolves to the second overload, which returns `number`, so it is no // longer flagged as a floating promise. bestEffort(() => 42); ``` - [#​10766](biomejs/biome#10766) [`7aff4c1`](biomejs/biome@7aff4c1) Thanks [@​JamBalaya56562](https://github.com/JamBalaya56562)! - Fixed [#​2862](biomejs/biome#2862): [`noInteractiveElementToNoninteractiveRole`](https://biomejs.dev/linter/rules/no-interactive-element-to-noninteractive-role/) no longer reports custom elements (a tag name containing a dash, e.g. `<my-button role="img" />`). Per the [W3C HTML-ARIA specification](https://www.w3.org/TR/html-aria/#el-autonomous-custom-element), a custom element may be given any role or none. - [#​10680](biomejs/biome#10680) [`771daa4`](biomejs/biome@771daa4) Thanks [@​WaterWhisperer](https://github.com/WaterWhisperer)! - Fixed [#​10635](biomejs/biome#10635): Biome now recognizes chained table tests such as `test.concurrent.each()` and `it.concurrent.each()` as test calls, fixing `noMisplacedAssertion` false positives and improving formatting for those test declarations. - [#​10759](biomejs/biome#10759) [`34570b5`](biomejs/biome@34570b5) Thanks [@​henrybrewer00-dotcom](https://github.com/henrybrewer00-dotcom)! - Fixed [#​10636](biomejs/biome#10636): [noStaticElementInteractions](https://biomejs.dev/linter/rules/no-static-element-interactions/) no longer reports a false positive for event handlers on Svelte special elements such as `<svelte:window>`, `<svelte:document>`, and `<svelte:body>`. These are not real DOM elements, so they are now ignored by the rule. - [#​10741](biomejs/biome#10741) [`bd2364e`](biomejs/biome@bd2364e) Thanks [@​JamBalaya56562](https://github.com/JamBalaya56562)! - Fixed [#​6686](biomejs/biome#6686): the `rage` command now respects the `--config-path` option and the `BIOME_CONFIG_PATH` environment variable when loading the Biome configuration. Previously it always used the default configuration resolution and reported the configuration as `Not set` when no `biome.json` existed in the working directory. - [#​10763](biomejs/biome#10763) [`2c3e82d`](biomejs/biome@2c3e82d) Thanks [@​Aqu1bp](https://github.com/Aqu1bp)! - Fixed [#​10742](biomejs/biome#10742): [`noSolidDestructuredProps`](https://biomejs.dev/linter/rules/no-solid-destructured-props) now reports destructured props in Solid function components and JSX children. - [#​10606](biomejs/biome#10606) [`a4cc4ab`](biomejs/biome@a4cc4ab) Thanks [@​Mokto](https://github.com/Mokto)! - Fixed false positives in `noUnusedImports`, `noUnusedVariables`, and `useImportType` for Svelte components that use both a `<script module>` and a `<script>` block. The two blocks compile to a single module and share a top-level scope, so a binding (import, function, or variable) declared in one block and used only in the other is no longer reported as unused. - [#​10767](biomejs/biome#10767) [`36d5aa7`](biomejs/biome@36d5aa7) Thanks [@​otkrickey](https://github.com/otkrickey)! - Fixed [#​10754](biomejs/biome#10754): [`useVueValidVBind`](https://biomejs.dev/linter/rules/use-vue-valid-v-bind/) no longer reports the Vue 3.4+ same-name shorthand as missing a value. `:foo` and `v-bind:foo` are now accepted as equivalent to `:foo="foo"`, while `v-bind`, `v-bind:[dynamicArg]`, and `:[dynamicArg]` without a value continue to be reported. - [#​10775](biomejs/biome#10775) [`a918af0`](biomejs/biome@a918af0) Thanks [@​WaterWhisperer](https://github.com/WaterWhisperer)! - Fixed an issue reported in [#​10708](biomejs/biome#10708): `biome rage` didn't detect running Biome daemon pipes on Windows. - [#​10730](biomejs/biome#10730) [`5a2e65b`](biomejs/biome@5a2e65b) Thanks [@​dinocosta](https://github.com/dinocosta)! - Fixed an issue where Biome was resolving [the well-known Zed settings file](https://biomejs.dev/guides/configure-biome/#well-known-files) from the wrong location on macOS and Windows. - [#​10807](biomejs/biome#10807) [`d97fffe`](biomejs/biome@d97fffe) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed an issue where `.scss` files were incorrectly analyzed when running `biome check`. - [#​10672](biomejs/biome#10672) [`53c6efc`](biomejs/biome@53c6efc) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed a bug where Biome incorrectly formatted snippets that have parsing errors. - [#​10719](biomejs/biome#10719) [`aa649b5`](biomejs/biome@aa649b5) Thanks [@​minseong0324](https://github.com/minseong0324)! - Fixed [`useAwaitThenable`](https://biomejs.dev/linter/rules/use-await-thenable/) false positive when awaiting a custom thenable that is not the global `Promise`. A value with a callable `then` member is now recognized as awaitable. ```ts interface Thenable<T> { then(onfulfilled: (value: T) => void): void; } declare const t: Thenable<number>; async function f() { await t; } ``` - [#​10734](biomejs/biome#10734) [`4396496`](biomejs/biome@4396496) Thanks [@​BangDori](https://github.com/BangDori)! - Fixed [#​10708](biomejs/biome#10708): `biome migrate` now preserves trivia when migrating the deprecated `recommended` option to `preset`. - [#​10683](biomejs/biome#10683) [`ae31a00`](biomejs/biome@ae31a00) Thanks [@​Netail](https://github.com/Netail)! - Fixed [#​10657](biomejs/biome#10657) [#​10671](biomejs/biome#10671) [#​10661](biomejs/biome#10661) [#​10637](biomejs/biome#10637) [#​10718](biomejs/biome#10718): HTML rules now correctly handle dynamic attributes. - [#​10746](biomejs/biome#10746) [`54e8239`](biomejs/biome@54e8239) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed an issue where [`noUndeclaredClasses`](https://biomejs.dev/linter/rules/no-undeclared-classes) didn't correctly detect styles defined inside the Astro directive `is:global`. - [#​10770](biomejs/biome#10770) [`dd1429c`](biomejs/biome@dd1429c) Thanks [@​ematipico](https://github.com/ematipico)! - Improved the Biome Language Server DX by orchestrating certain operations, so that they won't block the editor during typing. This improvement is more visible in large documents. - [#​10473](biomejs/biome#10473) [`d9b5133`](biomejs/biome@d9b5133) Thanks [@​Mokto](https://github.com/Mokto)! - Improved [`noUnusedImports`](https://biomejs.dev/linter/rules/no-unused-imports/), [`noUnusedVariables`](https://biomejs.dev/linter/rules/no-unused-variables/), [`noUnusedFunctionParameters`](https://biomejs.dev/linter/rules/no-unused-function-parameters/), and [`useImportType`](https://biomejs.dev/linter/rules/use-import-type/) for Svelte, Vue, and Astro files (with `html.experimentalFullSupportEnabled`). Bindings used only in the template — including component tags, attribute interpolations, directives, `bind:` shorthand, and snippet parameters — are no longer reported as unused, while genuinely unused ones still are. - [#​10796](biomejs/biome#10796) [`f1b3ab2`](biomejs/biome@f1b3ab2) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed an issue where the Biome Language Server didn't enable project or type-aware lint rules, even when they were explicitly enabled. - [#​10746](biomejs/biome#10746) [`54e8239`](biomejs/biome@54e8239) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed an issue where [`noUndeclaredClasses`](https://biomejs.dev/linter/rules/no-undeclared-classes) didn't detect styles declared inside HTML documents. - [#​10774](biomejs/biome#10774) [`bde945b`](biomejs/biome@bde945b) Thanks [@​pattrickrice](https://github.com/pattrickrice)! - Fixed [#​10268](biomejs/biome#10268) where a race condition resulted in internal errors such as: `The file biome.json does not exist in the workspace`. </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yMzQuMCIsInVwZGF0ZWRJblZlciI6IjQzLjIzNC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Reviewed-on: https://git.oirnoir.dev/OIRNOIR/YouTube-Helper-Client/pulls/9
This PR contains the following updates: | Package | Type | Update | Change | Pending | |---|---|---|---|---| | [@biomejs/biome](https://biomejs.dev) ([source](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome)) | imports | patch | [`2.5.1` -> `2.5.2`](https://renovatebot.com/diffs/npm/@biomejs%2fbiome/2.5.1/2.5.2) | `2.5.3` | --- ### Release Notes <details> <summary>biomejs/biome (@​biomejs/biome)</summary> ### [`v2.5.2`](https://github.com/biomejs/biome/blob/HEAD/packages/@​biomejs/biome/CHANGELOG.md#252) [Compare Source](https://github.com/biomejs/biome/compare/@biomejs/biome@2.5.1...@biomejs/biome@2.5.2) ##### Patch Changes - [#​10595](biomejs/biome#10595) [`f458028`](biomejs/biome@f458028) Thanks [@​pkallos](https://github.com/pkallos)! - Added the option `ignoreBooleanCoercion` to [useNullishCoalescing](https://biomejs.dev/linter/rules/use-nullish-coalescing/). When enabled, Biome ignores `||` and `||=` used inside a `Boolean()` call, where coalescing on falsy values is intentional. - [#​10798](biomejs/biome#10798) [`4a32b63`](biomejs/biome@4a32b63) Thanks [@​pkallos](https://github.com/pkallos)! - Added the option `ignorePrimitives` to [useNullishCoalescing](https://biomejs.dev/linter/rules/use-nullish-coalescing/). When enabled, Biome ignores `||`, `||=`, and ternary expressions whose non-nullish operands are all primitives the option opts out of. Use `true` to ignore all primitives, or an object selecting `string`, `number`, `boolean`, or `bigint`. - [#​10545](biomejs/biome#10545) [`f3d4c00`](biomejs/biome@f3d4c00) Thanks [@​Mokto](https://github.com/Mokto)! - Added the new nursery rule [`noSvelteUnnecessaryStateWrap`](https://biomejs.dev/linter/rules/no-svelte-unnecessary-state-wrap/), which reports unnecessary `$state()` wrapping of classes from `svelte/reactivity` that are already reactive. ```svelte <script> import { SvelteMap } from "svelte/reactivity"; const map = $state(new SvelteMap()); // redundant </script> ``` - [#​10752](biomejs/biome#10752) [`f62fb8b`](biomejs/biome@f62fb8b) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed [#​10739](biomejs/biome#10739). Now the rule [`useValidAutocomplete`](https://biomejs.dev/linter/rules/use-valid-autocomplete/) correctly flags the `autoComplete` attribute. - [#​10796](biomejs/biome#10796) [`f1b3ab2`](biomejs/biome@f1b3ab2) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed [#​10768](biomejs/biome#10768). Improved the performance of the Biome Language Server by cancelling certain in-flight operations when there are fast updates. - [#​10719](biomejs/biome#10719) [`aa649b5`](biomejs/biome@aa649b5) Thanks [@​minseong0324](https://github.com/minseong0324)! - Fixed [`noMisleadingReturnType`](https://biomejs.dev/linter/rules/no-misleading-return-type/) false positive on returns that use a widening type assertion: `"a" as string` is no longer reported as misleading. The rule now also reports a literal-pinning assertion such as `false as false`, matching the existing `as const` behavior. ```ts // No longer flagged (returns are `string`): function getValue(b: boolean): string { if (b) return "a" as string; return "b" as string; } // Now also reported, like `as const` (returns `false`): function isReady(): boolean { return false as false; } ``` - [#​10678](biomejs/biome#10678) [`8f073a7`](biomejs/biome@8f073a7) Thanks [@​PranavAchar01](https://github.com/PranavAchar01)! - Fixed [#​7718](biomejs/biome#7718): Biome now correctly parses CSS nesting selectors when `&` appears as a trailing sub-selector after a type selector, e.g. `h1& { color: red; }`. - [#​10756](biomejs/biome#10756) [`5ec965a`](biomejs/biome@5ec965a) Thanks [@​denbezrukov](https://github.com/denbezrukov)! - Fixed CSS formatter output for selector lists with `allowWrongLineComments` and `//` comments after a selector comma. Biome now keeps the selector before the line comment inline instead of breaking it across descendant combinators. ```diff -.powerPathNavigator - .helm - button.pressedButton, // pressed +.powerPathNavigator .helm button.pressedButton, // pressed .powerPathNavigator .helm button:active:not(.disabledButton) { } ``` - [#​10757](biomejs/biome#10757) [`6232fcd`](biomejs/biome@6232fcd) Thanks [@​PranavAchar01](https://github.com/PranavAchar01)! - Fixed [#​8269](biomejs/biome#8269): the CSS parser now accepts Tailwind `@variant` and `@utility` names that start with a digit, such as the `2xl` breakpoint. ```css @​utility container { @​variant 2xl { max-width: 1400px; } } ``` - [#​10777](biomejs/biome#10777) [`575ced6`](biomejs/biome@575ced6) Thanks [@​WaterWhisperer](https://github.com/WaterWhisperer)! - Fixed an issue reported in [#​10708](biomejs/biome#10708): the GitLab reporter now handles `--verbose` diagnostics filtering correctly. - [#​10281](biomejs/biome#10281) [`0efe244`](biomejs/biome@0efe244) Thanks [@​Zelys-DFKH](https://github.com/Zelys-DFKH)! - Fixed a bug where GritQL patterns rejected positional (unkeyed) arguments. - [#​10758](biomejs/biome#10758) [`e36fd8a`](biomejs/biome@e36fd8a) Thanks [@​henrybrewer00-dotcom](https://github.com/henrybrewer00-dotcom)! - Fixed [#​10697](biomejs/biome#10697): The formatter no longer removes the parentheses around an `await` or `yield` expression used as the target of a TypeScript instantiation expression. For example, `(await makeFactory)<Value>` is no longer reformatted to `await makeFactory<Value>`, which would change the meaning of the code. - [#​10586](biomejs/biome#10586) [`3617094`](biomejs/biome@3617094) Thanks [@​IxxyDev](https://github.com/IxxyDev)! - Fixed [#​9568](biomejs/biome#9568): [`noFloatingPromises`](https://biomejs.dev/linter/rules/no-floating-promises/) no longer reports a false positive when calling an overloaded function and the selected overload does not return a promise. ```ts function bestEffort(cb: () => Promise<number>): Promise<number>; function bestEffort(cb: () => number): number; function bestEffort( cb: () => number | Promise<number>, ): Promise<number> | number { return cb() as Promise<number> | number; } // This resolves to the second overload, which returns `number`, so it is no // longer flagged as a floating promise. bestEffort(() => 42); ``` - [#​10766](biomejs/biome#10766) [`7aff4c1`](biomejs/biome@7aff4c1) Thanks [@​JamBalaya56562](https://github.com/JamBalaya56562)! - Fixed [#​2862](biomejs/biome#2862): [`noInteractiveElementToNoninteractiveRole`](https://biomejs.dev/linter/rules/no-interactive-element-to-noninteractive-role/) no longer reports custom elements (a tag name containing a dash, e.g. `<my-button role="img" />`). Per the [W3C HTML-ARIA specification](https://www.w3.org/TR/html-aria/#el-autonomous-custom-element), a custom element may be given any role or none. - [#​10680](biomejs/biome#10680) [`771daa4`](biomejs/biome@771daa4) Thanks [@​WaterWhisperer](https://github.com/WaterWhisperer)! - Fixed [#​10635](biomejs/biome#10635): Biome now recognizes chained table tests such as `test.concurrent.each()` and `it.concurrent.each()` as test calls, fixing `noMisplacedAssertion` false positives and improving formatting for those test declarations. - [#​10759](biomejs/biome#10759) [`34570b5`](biomejs/biome@34570b5) Thanks [@​henrybrewer00-dotcom](https://github.com/henrybrewer00-dotcom)! - Fixed [#​10636](biomejs/biome#10636): [noStaticElementInteractions](https://biomejs.dev/linter/rules/no-static-element-interactions/) no longer reports a false positive for event handlers on Svelte special elements such as `<svelte:window>`, `<svelte:document>`, and `<svelte:body>`. These are not real DOM elements, so they are now ignored by the rule. - [#​10741](biomejs/biome#10741) [`bd2364e`](biomejs/biome@bd2364e) Thanks [@​JamBalaya56562](https://github.com/JamBalaya56562)! - Fixed [#​6686](biomejs/biome#6686): the `rage` command now respects the `--config-path` option and the `BIOME_CONFIG_PATH` environment variable when loading the Biome configuration. Previously it always used the default configuration resolution and reported the configuration as `Not set` when no `biome.json` existed in the working directory. - [#​10763](biomejs/biome#10763) [`2c3e82d`](biomejs/biome@2c3e82d) Thanks [@​Aqu1bp](https://github.com/Aqu1bp)! - Fixed [#​10742](biomejs/biome#10742): [`noSolidDestructuredProps`](https://biomejs.dev/linter/rules/no-solid-destructured-props) now reports destructured props in Solid function components and JSX children. - [#​10606](biomejs/biome#10606) [`a4cc4ab`](biomejs/biome@a4cc4ab) Thanks [@​Mokto](https://github.com/Mokto)! - Fixed false positives in `noUnusedImports`, `noUnusedVariables`, and `useImportType` for Svelte components that use both a `<script module>` and a `<script>` block. The two blocks compile to a single module and share a top-level scope, so a binding (import, function, or variable) declared in one block and used only in the other is no longer reported as unused. - [#​10767](biomejs/biome#10767) [`36d5aa7`](biomejs/biome@36d5aa7) Thanks [@​otkrickey](https://github.com/otkrickey)! - Fixed [#​10754](biomejs/biome#10754): [`useVueValidVBind`](https://biomejs.dev/linter/rules/use-vue-valid-v-bind/) no longer reports the Vue 3.4+ same-name shorthand as missing a value. `:foo` and `v-bind:foo` are now accepted as equivalent to `:foo="foo"`, while `v-bind`, `v-bind:[dynamicArg]`, and `:[dynamicArg]` without a value continue to be reported. - [#​10775](biomejs/biome#10775) [`a918af0`](biomejs/biome@a918af0) Thanks [@​WaterWhisperer](https://github.com/WaterWhisperer)! - Fixed an issue reported in [#​10708](biomejs/biome#10708): `biome rage` didn't detect running Biome daemon pipes on Windows. - [#​10730](biomejs/biome#10730) [`5a2e65b`](biomejs/biome@5a2e65b) Thanks [@​dinocosta](https://github.com/dinocosta)! - Fixed an issue where Biome was resolving [the well-known Zed settings file](https://biomejs.dev/guides/configure-biome/#well-known-files) from the wrong location on macOS and Windows. - [#​10807](biomejs/biome#10807) [`d97fffe`](biomejs/biome@d97fffe) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed an issue where `.scss` files were incorrectly analyzed when running `biome check`. - [#​10672](biomejs/biome#10672) [`53c6efc`](biomejs/biome@53c6efc) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed a bug where Biome incorrectly formatted snippets that have parsing errors. - [#​10719](biomejs/biome#10719) [`aa649b5`](biomejs/biome@aa649b5) Thanks [@​minseong0324](https://github.com/minseong0324)! - Fixed [`useAwaitThenable`](https://biomejs.dev/linter/rules/use-await-thenable/) false positive when awaiting a custom thenable that is not the global `Promise`. A value with a callable `then` member is now recognized as awaitable. ```ts interface Thenable<T> { then(onfulfilled: (value: T) => void): void; } declare const t: Thenable<number>; async function f() { await t; } ``` - [#​10734](biomejs/biome#10734) [`4396496`](biomejs/biome@4396496) Thanks [@​BangDori](https://github.com/BangDori)! - Fixed [#​10708](biomejs/biome#10708): `biome migrate` now preserves trivia when migrating the deprecated `recommended` option to `preset`. - [#​10683](biomejs/biome#10683) [`ae31a00`](biomejs/biome@ae31a00) Thanks [@​Netail](https://github.com/Netail)! - Fixed [#​10657](biomejs/biome#10657) [#​10671](biomejs/biome#10671) [#​10661](biomejs/biome#10661) [#​10637](biomejs/biome#10637) [#​10718](biomejs/biome#10718): HTML rules now correctly handle dynamic attributes. - [#​10746](biomejs/biome#10746) [`54e8239`](biomejs/biome@54e8239) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed an issue where [`noUndeclaredClasses`](https://biomejs.dev/linter/rules/no-undeclared-classes) didn't correctly detect styles defined inside the Astro directive `is:global`. - [#​10770](biomejs/biome#10770) [`dd1429c`](biomejs/biome@dd1429c) Thanks [@​ematipico](https://github.com/ematipico)! - Improved the Biome Language Server DX by orchestrating certain operations, so that they won't block the editor during typing. This improvement is more visible in large documents. - [#​10473](biomejs/biome#10473) [`d9b5133`](biomejs/biome@d9b5133) Thanks [@​Mokto](https://github.com/Mokto)! - Improved [`noUnusedImports`](https://biomejs.dev/linter/rules/no-unused-imports/), [`noUnusedVariables`](https://biomejs.dev/linter/rules/no-unused-variables/), [`noUnusedFunctionParameters`](https://biomejs.dev/linter/rules/no-unused-function-parameters/), and [`useImportType`](https://biomejs.dev/linter/rules/use-import-type/) for Svelte, Vue, and Astro files (with `html.experimentalFullSupportEnabled`). Bindings used only in the template — including component tags, attribute interpolations, directives, `bind:` shorthand, and snippet parameters — are no longer reported as unused, while genuinely unused ones still are. - [#​10796](biomejs/biome#10796) [`f1b3ab2`](biomejs/biome@f1b3ab2) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed an issue where the Biome Language Server didn't enable project or type-aware lint rules, even when they were explicitly enabled. - [#​10746](biomejs/biome#10746) [`54e8239`](biomejs/biome@54e8239) Thanks [@​ematipico](https://github.com/ematipico)! - Fixed an issue where [`noUndeclaredClasses`](https://biomejs.dev/linter/rules/no-undeclared-classes) didn't detect styles declared inside HTML documents. - [#​10774](biomejs/biome#10774) [`bde945b`](biomejs/biome@bde945b) Thanks [@​pattrickrice](https://github.com/pattrickrice)! - Fixed [#​10268](biomejs/biome#10268) where a race condition resulted in internal errors such as: `The file biome.json does not exist in the workspace`. </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNDYuMSIsInVwZGF0ZWRJblZlciI6IjQzLjI0Ni4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Reviewed-on: https://git.oirnoir.dev/OIRNOIR/YouTube-Helper-Server/pulls/22
Summary
Note
I developed the changes with the help of Codex 5.5. It went through different iterations, and I changed things at different times.
Closes #10768
This PR should improve the LSP DX for certain operations, mostly analyser operations. The DX comes from the salsa-baked cancellation model, where queries are cancelled in-flight when an entry is updated and there's an existing one.
The salsa model is simple: there's a single database, and every time there's a
.clone()(i.e., a read-only version), its reference count increases. Once all the read-only snapshots are released, salsa can safely update its entries, otherwise there's a deadlock. This means that there must be one single database, and it can't be shared among threads. This means that the database can't live inside theWorkspace, because it isSyncandSendand our database isn't.So now the database is kept outside of the workspace. In the CLI, we now have a new type called
LocalWorkspace, which is created when the CLI runs without--use-server. It implements all theWorkspacemethods, and provides the current DB signature to theWorkspaceServer.The
WorkspaceServermethods have been updated to receive the newDbStorage.DbStorageis a small abstraction over the database:::Sharedvariant, and we always add new entries and replace the old ones. We aren't interested in updating the existing ones, because we don't need a cancellation system::Ownedvariant, which containsparking_lot::Mutex. We use aMutexbecause we need a&mutsignature to update database entries, and aMutexis the only way to obtain it. However, I believe this is fine because:Other changes:
biome cleanfinishesTest Plan
Added new tests and manually tested the fixes.
Docs
N/A