-
-
Notifications
You must be signed in to change notification settings - Fork 715
feat: emit diagnostics from embedded nodes #7632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
CodSpeed Performance ReportMerging #7632 will not alter performanceComparing Summary
|
WalkthroughThis PR refactors diagnostics and embedded-parse handling across the workspace: introduces NodeParse and EmbeddedNodeParse alongside a variant-based AnyParse; adds offset-aware diagnostics (ParseDiagnostic, RuleDiagnostic, AnalyzerDiagnostic) and APIs to shift diagnostic spans; unifies embedded content as EmbeddedSnippets/EmbeddedLanguageContent with AnyParse payloads; wires parse_embedded_nodes through service handlers, document storage, formatting and lint flows; introduces HTML linter/assist configuration and code-actions scaffolding; and updates many language parsers and tests to the new parse/offset diagnostics model. Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used📓 Path-based instructions (1)crates/biome_*/**📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧬 Code graph analysis (3)crates/biome_parser/src/lib.rs (3)
crates/biome_analyze/src/diagnostics.rs (1)
crates/biome_service/src/workspace/server.rs (5)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (22)
🔇 Additional comments (23)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
🧹 Nitpick comments (7)
crates/biome_configuration/src/json.rs (1)
137-137
: Doc comment still references the linterTiny nit: this struct drives assists, so the comment should mention assists rather than the linter.
Apply this diff to clarify it:
-/// Assist options specific to the JSON linter +/// Assist options specific to JSON assistscrates/biome_formatter/src/lib.rs (1)
920-922
: Consider adding documentation for the new method.The implementation is correct, and the method signature is clear. However, adding a doc comment would help users understand when to use
swap_document
versusinto_document
.Example:
+ /// Replaces the internal document with the provided one. + /// + /// This is useful when you need to modify the document in place + /// without consuming the `Formatted` instance. pub fn swap_document(&mut self, document: Document) { self.document = document; }crates/biome_analyze/src/rule.rs (1)
19-19
: Prefer+
over.add(...)
and drop thestd::ops::Add
importCleaner and avoids bringing the trait into scope explicitly.
- use std::ops::Add; + // (no import required)- let span = span.add(advice_offset); + let span = span + advice_offset;Also applies to: 1322-1325
crates/biome_service/src/workspace/document.rs (3)
39-47
: Addis_json()
for API parityYou added is_js/is_css but not is_json. Mirror the helpers for consistency.
pub const fn is_css(&self) -> bool { matches!(self, Self::Css(..)) } + + pub const fn is_json(&self) -> bool { + matches!(self, Self::Json(..)) + }
48-70
: Consider borrowing accessors to avoid clones
as_js_embedded_snippet
/as_css_*
/as_json_*
return owned clones. ReturningOption<&EmbeddedLanguageContent<_>>
would avoid extra clones (even if cheap).
149-164
: Default file_source_index = 0 can be ambiguousIf 0 is a valid index, it’s easy to forget to set. Consider passing it to
new
or using a sentinel (e.g., usize::MAX) and assert before use.crates/biome_parser/src/lib.rs (1)
762-772
: Consider a borrowedembedded_syntax_ref(&self)
Today callers must clone
AnyParse
to callembedded_syntax(self)
. Providing a borrowed variant would avoid the extra clone and match the non-embeddedsyntax(&self)
ergonomics.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (8)
Cargo.lock
is excluded by!**/*.lock
and included by**
crates/biome_cli/tests/snapshots/main_cases_html/should_pull_diagnostics_from_embedded_languages_when_formatting.snap
is excluded by!**/*.snap
and included by**
crates/biome_cli/tests/snapshots/main_cases_html/should_pull_diagnostics_from_embedded_languages_when_linting.snap
is excluded by!**/*.snap
and included by**
crates/biome_cli/tests/snapshots/main_commands_check/check_help.snap
is excluded by!**/*.snap
and included by**
crates/biome_cli/tests/snapshots/main_commands_ci/ci_help.snap
is excluded by!**/*.snap
and included by**
crates/biome_configuration/src/generated/domain_selector.rs
is excluded by!**/generated/**
,!**/generated/**
and included by**
packages/@biomejs/backend-jsonrpc/src/workspace.ts
is excluded by!**/backend-jsonrpc/src/workspace.ts
and included by**
packages/@biomejs/biome/configuration_schema.json
is excluded by!**/configuration_schema.json
and included by**
📒 Files selected for processing (48)
crates/biome_analyze/src/diagnostics.rs
(3 hunks)crates/biome_analyze/src/rule.rs
(4 hunks)crates/biome_cli/src/execute/traverse.rs
(1 hunks)crates/biome_cli/tests/cases/html.rs
(1 hunks)crates/biome_configuration/src/html.rs
(2 hunks)crates/biome_configuration/src/json.rs
(1 hunks)crates/biome_css_parser/src/lib.rs
(4 hunks)crates/biome_formatter/src/lib.rs
(1 hunks)crates/biome_graphql_formatter/tests/language.rs
(2 hunks)crates/biome_graphql_parser/src/lib.rs
(2 hunks)crates/biome_grit_parser/src/lib.rs
(2 hunks)crates/biome_grit_patterns/src/grit_target_language/css_target_language/generated_mappings.rs
(1 hunks)crates/biome_html_parser/src/lib.rs
(2 hunks)crates/biome_html_syntax/Cargo.toml
(1 hunks)crates/biome_html_syntax/src/element_ext.rs
(2 hunks)crates/biome_js_analyze/tests/spec_tests.rs
(5 hunks)crates/biome_js_parser/src/options.rs
(1 hunks)crates/biome_js_parser/src/parse.rs
(3 hunks)crates/biome_js_parser/src/parser.rs
(1 hunks)crates/biome_js_transform/tests/spec_tests.rs
(2 hunks)crates/biome_json_parser/src/lib.rs
(4 hunks)crates/biome_parser/src/diagnostic.rs
(6 hunks)crates/biome_parser/src/lib.rs
(4 hunks)crates/biome_parser/src/tree_sink.rs
(1 hunks)crates/biome_plugin_loader/src/analyzer_grit_plugin.rs
(2 hunks)crates/biome_rowan/src/syntax/node.rs
(2 hunks)crates/biome_service/src/file_handlers/astro.rs
(1 hunks)crates/biome_service/src/file_handlers/css.rs
(2 hunks)crates/biome_service/src/file_handlers/graphql.rs
(2 hunks)crates/biome_service/src/file_handlers/grit.rs
(2 hunks)crates/biome_service/src/file_handlers/html.rs
(10 hunks)crates/biome_service/src/file_handlers/javascript.rs
(2 hunks)crates/biome_service/src/file_handlers/json.rs
(2 hunks)crates/biome_service/src/file_handlers/mod.rs
(10 hunks)crates/biome_service/src/file_handlers/svelte.rs
(1 hunks)crates/biome_service/src/file_handlers/vue.rs
(1 hunks)crates/biome_service/src/projects.rs
(0 hunks)crates/biome_service/src/settings.rs
(1 hunks)crates/biome_service/src/workspace.rs
(3 hunks)crates/biome_service/src/workspace/document.rs
(4 hunks)crates/biome_service/src/workspace/server.rs
(12 hunks)crates/biome_service/src/workspace/server.tests.rs
(2 hunks)crates/biome_yaml_parser/src/lib.rs
(2 hunks)xtask/coverage/src/js/test262.rs
(1 hunks)xtask/coverage/src/jsx/jsx_babel.rs
(1 hunks)xtask/coverage/src/runner.rs
(1 hunks)xtask/coverage/src/symbols/msts.rs
(1 hunks)xtask/coverage/src/ts/ts_babel.rs
(1 hunks)
💤 Files with no reviewable changes (1)
- crates/biome_service/src/projects.rs
🧰 Additional context used
📓 Path-based instructions (10)
crates/biome_*_{syntax,parser,formatter,analyze,factory,semantic}/**
📄 CodeRabbit inference engine (CLAUDE.md)
Maintain the per-language crate structure: biome_{lang}_{syntax,parser,formatter,analyze,factory,semantic}
Files:
crates/biome_html_syntax/Cargo.toml
crates/biome_js_parser/src/options.rs
crates/biome_js_parser/src/parser.rs
crates/biome_yaml_parser/src/lib.rs
crates/biome_html_syntax/src/element_ext.rs
crates/biome_html_parser/src/lib.rs
crates/biome_js_parser/src/parse.rs
crates/biome_js_analyze/tests/spec_tests.rs
crates/biome_grit_parser/src/lib.rs
crates/biome_json_parser/src/lib.rs
crates/biome_graphql_formatter/tests/language.rs
crates/biome_graphql_parser/src/lib.rs
crates/biome_css_parser/src/lib.rs
crates/biome_*/**
📄 CodeRabbit inference engine (CLAUDE.md)
Place core crates under /crates/biome_*/
Files:
crates/biome_html_syntax/Cargo.toml
crates/biome_js_parser/src/options.rs
crates/biome_formatter/src/lib.rs
crates/biome_service/src/file_handlers/vue.rs
crates/biome_service/src/workspace/server.tests.rs
crates/biome_configuration/src/json.rs
crates/biome_js_parser/src/parser.rs
crates/biome_service/src/file_handlers/svelte.rs
crates/biome_service/src/file_handlers/json.rs
crates/biome_yaml_parser/src/lib.rs
crates/biome_html_syntax/src/element_ext.rs
crates/biome_html_parser/src/lib.rs
crates/biome_js_parser/src/parse.rs
crates/biome_analyze/src/diagnostics.rs
crates/biome_grit_patterns/src/grit_target_language/css_target_language/generated_mappings.rs
crates/biome_js_analyze/tests/spec_tests.rs
crates/biome_parser/src/diagnostic.rs
crates/biome_service/src/settings.rs
crates/biome_grit_parser/src/lib.rs
crates/biome_service/src/workspace.rs
crates/biome_service/src/file_handlers/mod.rs
crates/biome_cli/src/execute/traverse.rs
crates/biome_analyze/src/rule.rs
crates/biome_service/src/file_handlers/css.rs
crates/biome_json_parser/src/lib.rs
crates/biome_plugin_loader/src/analyzer_grit_plugin.rs
crates/biome_service/src/file_handlers/graphql.rs
crates/biome_service/src/workspace/document.rs
crates/biome_service/src/file_handlers/javascript.rs
crates/biome_graphql_formatter/tests/language.rs
crates/biome_parser/src/lib.rs
crates/biome_service/src/file_handlers/html.rs
crates/biome_parser/src/tree_sink.rs
crates/biome_service/src/file_handlers/astro.rs
crates/biome_graphql_parser/src/lib.rs
crates/biome_service/src/file_handlers/grit.rs
crates/biome_rowan/src/syntax/node.rs
crates/biome_configuration/src/html.rs
crates/biome_cli/tests/cases/html.rs
crates/biome_service/src/workspace/server.rs
crates/biome_css_parser/src/lib.rs
crates/biome_js_transform/tests/spec_tests.rs
**/*.toml
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Format all TOML files before committing (just f, via taplo-cli)
Files:
crates/biome_html_syntax/Cargo.toml
crates/**/Cargo.toml
📄 CodeRabbit inference engine (CONTRIBUTING.md)
crates/**/Cargo.toml
: In internal crates, reference internal dependencies with workspace = true
Use path dependencies for dev-dependencies in internal crates to avoid requiring published versions
Files:
crates/biome_html_syntax/Cargo.toml
crates/*/Cargo.toml
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Place new crates under the crates/ directory
Files:
crates/biome_html_syntax/Cargo.toml
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Format all Rust source files before committing (just f)
Files:
crates/biome_js_parser/src/options.rs
xtask/coverage/src/js/test262.rs
crates/biome_formatter/src/lib.rs
crates/biome_service/src/file_handlers/vue.rs
crates/biome_service/src/workspace/server.tests.rs
crates/biome_configuration/src/json.rs
crates/biome_js_parser/src/parser.rs
xtask/coverage/src/ts/ts_babel.rs
crates/biome_service/src/file_handlers/svelte.rs
crates/biome_service/src/file_handlers/json.rs
crates/biome_yaml_parser/src/lib.rs
crates/biome_html_syntax/src/element_ext.rs
crates/biome_html_parser/src/lib.rs
crates/biome_js_parser/src/parse.rs
crates/biome_analyze/src/diagnostics.rs
crates/biome_grit_patterns/src/grit_target_language/css_target_language/generated_mappings.rs
crates/biome_js_analyze/tests/spec_tests.rs
crates/biome_parser/src/diagnostic.rs
crates/biome_service/src/settings.rs
crates/biome_grit_parser/src/lib.rs
crates/biome_service/src/workspace.rs
crates/biome_service/src/file_handlers/mod.rs
crates/biome_cli/src/execute/traverse.rs
crates/biome_analyze/src/rule.rs
crates/biome_service/src/file_handlers/css.rs
crates/biome_json_parser/src/lib.rs
crates/biome_plugin_loader/src/analyzer_grit_plugin.rs
crates/biome_service/src/file_handlers/graphql.rs
xtask/coverage/src/runner.rs
xtask/coverage/src/symbols/msts.rs
crates/biome_service/src/workspace/document.rs
crates/biome_service/src/file_handlers/javascript.rs
crates/biome_graphql_formatter/tests/language.rs
crates/biome_parser/src/lib.rs
crates/biome_service/src/file_handlers/html.rs
crates/biome_parser/src/tree_sink.rs
crates/biome_service/src/file_handlers/astro.rs
crates/biome_graphql_parser/src/lib.rs
crates/biome_service/src/file_handlers/grit.rs
crates/biome_rowan/src/syntax/node.rs
crates/biome_configuration/src/html.rs
crates/biome_cli/tests/cases/html.rs
crates/biome_service/src/workspace/server.rs
xtask/coverage/src/jsx/jsx_babel.rs
crates/biome_css_parser/src/lib.rs
crates/biome_js_transform/tests/spec_tests.rs
crates/biome_configuration/src/**
📄 CodeRabbit inference engine (CLAUDE.md)
Keep configuration sources under biome_configuration/src/
Files:
crates/biome_configuration/src/json.rs
crates/biome_configuration/src/html.rs
**/tests/**
📄 CodeRabbit inference engine (CLAUDE.md)
Place test files under a tests/ directory in each crate
Files:
crates/biome_js_analyze/tests/spec_tests.rs
crates/biome_graphql_formatter/tests/language.rs
crates/biome_cli/tests/cases/html.rs
crates/biome_js_transform/tests/spec_tests.rs
crates/biome_service/src/workspace.rs
📄 CodeRabbit inference engine (crates/biome_service/CONTRIBUTING.md)
Implement the Workspace trait in src/workspace.rs
Files:
crates/biome_service/src/workspace.rs
crates/biome_service/src/workspace/server.rs
📄 CodeRabbit inference engine (crates/biome_service/CONTRIBUTING.md)
Use WorkspaceServer (src/workspace/server.rs) to maintain workspace state in daemon and CLI daemonless modes
Files:
crates/biome_service/src/workspace/server.rs
🧠 Learnings (32)
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/Cargo.toml : Add the specified dev-dependencies (biome_formatter_test, biome_html_factory, biome_html_parser, biome_parser, biome_service, countme with feature enable, iai 0.1.1, quickcheck, quickcheck_macros, tests_macros) to Cargo.toml under [dev-dependencies]
Applied to files:
crates/biome_html_syntax/Cargo.toml
📚 Learning: 2025-08-11T11:48:52.001Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:52.001Z
Learning: Applies to crates/biome_js_formatter/**/Cargo.toml : Add biome_js_formatter as a path dependency in Cargo.toml: biome_js_formatter = { version = "0.0.1", path = "../biome_js_formatter" }
Applied to files:
crates/biome_html_syntax/Cargo.toml
crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-09-07T17:35:00.517Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-09-07T17:35:00.517Z
Learning: Applies to crates/**/Cargo.toml : Use path dependencies for dev-dependencies in internal crates to avoid requiring published versions
Applied to files:
crates/biome_html_syntax/Cargo.toml
📚 Learning: 2025-08-17T08:55:30.118Z
Learnt from: CR
PR: biomejs/biome#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-17T08:55:30.118Z
Learning: Applies to crates/biome_*_{syntax,parser,formatter,analyze,factory,semantic}/** : Maintain the per-language crate structure: biome_{lang}_{syntax,parser,formatter,analyze,factory,semantic}
Applied to files:
crates/biome_html_syntax/Cargo.toml
📚 Learning: 2025-09-07T17:35:00.517Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-09-07T17:35:00.517Z
Learning: Applies to Cargo.toml : Define shared workspace dependencies in the root Cargo.toml using the [workspace.dependencies] table
Applied to files:
crates/biome_html_syntax/Cargo.toml
📚 Learning: 2025-09-10T08:05:22.867Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-10T08:05:22.867Z
Learning: Applies to crates/biome_analyze/crates/biome_rule_options/lib/**/*.rs : Options types must implement serialization/deserialization and schema support using derives: `Serialize`, `Deserialize`, `Deserializable`, and `#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]`
Applied to files:
crates/biome_html_syntax/Cargo.toml
crates/biome_js_parser/src/options.rs
📚 Learning: 2025-09-07T17:35:00.517Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-09-07T17:35:00.517Z
Learning: Update documentation when features change; for rules/assists/options, use inline Rust rustdoc
Applied to files:
crates/biome_configuration/src/json.rs
📚 Learning: 2025-08-11T11:46:05.836Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:46:05.836Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Use helper advice types from biome_diagnostics::v2 (CodeFrameAdvice, CommandAdvice, DiffAdvice, LogAdvice) when suitable
Applied to files:
crates/biome_analyze/src/diagnostics.rs
crates/biome_parser/src/diagnostic.rs
crates/biome_analyze/src/rule.rs
📚 Learning: 2025-08-11T11:46:05.836Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:46:05.836Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Types implementing Diagnostic must also implement Debug (e.g., use #[derive(Debug, Diagnostic)])
Applied to files:
crates/biome_analyze/src/diagnostics.rs
📚 Learning: 2025-08-11T11:46:05.836Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:46:05.836Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Fields marked with #[advice] or #[verbose_advice] must implement the Advices trait and record advices via Visit
Applied to files:
crates/biome_analyze/src/diagnostics.rs
crates/biome_parser/src/diagnostic.rs
crates/biome_analyze/src/rule.rs
📚 Learning: 2025-08-11T11:46:05.836Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:46:05.836Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Specify category and severity using #[diagnostic(...)] on the type or derive them from fields
Applied to files:
crates/biome_analyze/src/diagnostics.rs
crates/biome_parser/src/diagnostic.rs
📚 Learning: 2025-09-10T08:05:22.867Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-10T08:05:22.867Z
Learning: Applies to crates/biome_analyze/**/src/{lint,assist}/**/*.rs : Code blocks in rule docs must specify language; invalid snippets require `expect_diagnostic`; use `options`/`full_options`/`use_options` markers as appropriate
Applied to files:
crates/biome_analyze/src/diagnostics.rs
📚 Learning: 2025-08-11T11:46:05.836Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:46:05.836Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Most diagnostic attributes may be specified only once (either on the type or a single field); #[advice] and #[verbose_advice] may appear multiple times and are recorded in declaration order
Applied to files:
crates/biome_analyze/src/diagnostics.rs
crates/biome_parser/src/diagnostic.rs
📚 Learning: 2025-08-11T11:46:05.836Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:46:05.836Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : #[derive(Diagnostic)] can be used on enums only if every variant contains a diagnostic type
Applied to files:
crates/biome_analyze/src/diagnostics.rs
📚 Learning: 2025-08-11T11:53:15.299Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:53:15.299Z
Learning: Applies to crates/biome_service/src/workspace_watcher.rs : Keep workspace state in sync with the filesystem using WorkspaceWatcher; only active in daemon mode
Applied to files:
crates/biome_service/src/workspace.rs
crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-09-10T08:05:22.867Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-10T08:05:22.867Z
Learning: Applies to crates/biome_analyze/crates/biome_rule_options/lib/**/*.rs : Define per-rule options types in `biome_rule_options` crate (one file per rule, e.g., `lib/use_my_rule.rs`)
Applied to files:
crates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-09-10T08:05:22.867Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-10T08:05:22.867Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/tests/quick_test.rs : Quick test: edit `tests/quick_test.rs`, remove or comment `#[ignore]`, set `SOURCE`, and adjust `RuleFilter`
Applied to files:
crates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-09-10T08:05:22.867Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-10T08:05:22.867Z
Learning: Applies to crates/biome_analyze/**/src/{lint,assist}/**/*.rs : Recommended rules with domains are enabled only when users enable the matching domains; use `domains` metadata judiciously
Applied to files:
crates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-08-11T11:48:52.001Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:52.001Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the FormatNode trait and implement it for your Node
Applied to files:
crates/biome_graphql_formatter/tests/language.rs
crates/biome_service/src/file_handlers/html.rs
crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-08-11T11:48:52.001Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:52.001Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Use the generic Format trait and FormatNode for AST nodes when implementing the formatter
Applied to files:
crates/biome_graphql_formatter/tests/language.rs
crates/biome_service/src/file_handlers/html.rs
crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/src/lib.rs : Expose a documented public function format_node(options: HtmlFormatOptions, root: &HtmlSyntaxNode) -> FormatResult<Formatted<HtmlFormatContext>> delegating to biome_formatter::format_node
Applied to files:
crates/biome_service/src/file_handlers/html.rs
crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/src/cst.rs : Define FormatHtmlSyntaxNode in cst.rs and implement FormatRule<HtmlSyntaxNode>, plus AsFormat and IntoFormat for HtmlSyntaxNode using the provided mapping code
Applied to files:
crates/biome_service/src/file_handlers/html.rs
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/language.rs : Create tests/language.rs defining HtmlTestFormatLanguage and implement TestFormatLanguage for it
Applied to files:
crates/biome_cli/tests/cases/html.rs
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/spec_tests.rs : Create tests/spec_tests.rs in the biome_html_formatter crate that generates tests via tests_macros::gen_tests! for all HTML files at tests/specs/html/**/*.html
Applied to files:
crates/biome_cli/tests/cases/html.rs
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/spec_test.rs : Create tests/spec_test.rs implementing the run(spec_input_file, _expected_file, test_directory, _file_type) function as shown and include!("language.rs")
Applied to files:
crates/biome_cli/tests/cases/html.rs
📚 Learning: 2025-08-17T08:55:30.118Z
Learnt from: CR
PR: biomejs/biome#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-17T08:55:30.118Z
Learning: Applies to crates/biome_html_formatter/benches/html_formatter.rs : Maintain the HTML formatter benchmark at benches/html_formatter.rs within the biome_html_formatter crate
Applied to files:
crates/biome_cli/tests/cases/html.rs
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/specs/html/**/*.html : Place HTML test fixtures under tests/specs/html and subfolders, using .html files
Applied to files:
crates/biome_cli/tests/cases/html.rs
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/src/lib.rs : Place the plumbing traits and impls (AsFormat, IntoFormat, FormattedIterExt, and their Iterator adapters) in the biome_html_formatter crate’s lib.rs
Applied to files:
crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-08-11T11:48:52.001Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:52.001Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Use dbg_write! to debug and inspect the written IR elements during formatter development
Applied to files:
crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-08-11T11:48:52.001Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:52.001Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Build an intermediate IR via the provided helper APIs when formatting
Applied to files:
crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-08-11T11:53:15.299Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:53:15.299Z
Learning: Applies to crates/biome_service/src/workspace/server.rs : Use WorkspaceServer (src/workspace/server.rs) to maintain workspace state in daemon and CLI daemonless modes
Applied to files:
crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-08-11T11:53:15.299Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:53:15.299Z
Learning: Applies to crates/biome_service/src/workspace.rs : Implement the Workspace trait in src/workspace.rs
Applied to files:
crates/biome_service/src/workspace/server.rs
🧬 Code graph analysis (33)
xtask/coverage/src/js/test262.rs (1)
xtask/coverage/src/runner.rs (2)
files
(38-45)single
(115-129)
crates/biome_service/src/file_handlers/vue.rs (2)
crates/biome_service/src/workspace/document.rs (3)
parse
(80-86)parse
(168-168)parse
(173-180)crates/biome_service/src/workspace/server.rs (1)
parse
(543-569)
xtask/coverage/src/ts/ts_babel.rs (2)
crates/biome_formatter/src/lib.rs (3)
options
(754-754)options
(816-818)options
(1435-1435)crates/biome_js_parser/src/parser.rs (1)
options
(59-61)
crates/biome_service/src/file_handlers/svelte.rs (3)
crates/biome_service/src/file_handlers/html.rs (1)
parse
(361-375)crates/biome_service/src/workspace/document.rs (3)
parse
(80-86)parse
(168-168)parse
(173-180)crates/biome_service/src/workspace/server.rs (1)
parse
(543-569)
crates/biome_service/src/file_handlers/json.rs (2)
crates/biome_service/src/workspace/document.rs (3)
parse
(80-86)parse
(168-168)parse
(173-180)crates/biome_service/src/workspace/server.rs (2)
parse
(543-569)diagnostics
(1321-1324)
crates/biome_yaml_parser/src/lib.rs (2)
crates/biome_json_parser/src/lib.rs (4)
new
(58-63)new
(159-161)diagnostics
(71-73)diagnostics
(188-190)crates/biome_parser/src/lib.rs (7)
new
(52-58)root
(839-841)root
(899-901)diagnostics
(66-68)diagnostics
(722-727)diagnostics
(880-882)diagnostics
(903-905)
crates/biome_html_syntax/src/element_ext.rs (2)
crates/biome_html_syntax/src/lib.rs (1)
inner_string_text
(119-128)crates/biome_html_syntax/src/script_type.rs (1)
is_javascript_module
(55-57)
crates/biome_html_parser/src/lib.rs (2)
crates/biome_service/src/workspace/document.rs (1)
new
(150-164)crates/biome_parser/src/lib.rs (9)
new
(52-58)new
(835-837)new
(896-898)root
(839-841)root
(899-901)diagnostics
(66-68)diagnostics
(722-727)diagnostics
(880-882)diagnostics
(903-905)
crates/biome_js_parser/src/parse.rs (3)
crates/biome_json_parser/src/lib.rs (8)
new
(58-63)new
(159-161)diagnostics
(71-73)diagnostics
(188-190)from
(107-116)from
(214-223)syntax
(66-68)syntax
(183-185)crates/biome_css_parser/src/lib.rs (7)
new
(59-61)new
(133-135)diagnostics
(87-89)diagnostics
(143-145)from
(113-122)syntax
(82-84)syntax
(138-140)crates/biome_parser/src/lib.rs (11)
root
(839-841)root
(899-901)diagnostics
(66-68)diagnostics
(722-727)diagnostics
(880-882)diagnostics
(903-905)syntax
(750-760)syntax
(847-857)syntax
(864-864)syntax
(926-931)syntax
(938-938)
crates/biome_analyze/src/diagnostics.rs (1)
crates/biome_analyze/src/rule.rs (2)
diagnostic
(1143-1145)span
(1470-1472)
crates/biome_js_analyze/tests/spec_tests.rs (3)
crates/biome_service/src/file_handlers/html.rs (1)
parse
(361-375)xtask/coverage/src/runner.rs (1)
parse
(87-89)crates/biome_service/src/file_handlers/javascript.rs (1)
parse
(536-551)
crates/biome_parser/src/diagnostic.rs (2)
crates/biome_analyze/src/diagnostics.rs (7)
location
(80-87)category
(44-49)message
(57-64)description
(50-55)severity
(66-71)advices
(89-101)record
(235-243)crates/biome_analyze/src/rule.rs (10)
location
(1306-1308)category
(1290-1292)message
(1294-1296)description
(1298-1300)severity
(620-623)severity
(1286-1288)advices
(1310-1312)record
(1316-1350)detail
(1430-1432)span
(1470-1472)
crates/biome_grit_parser/src/lib.rs (1)
crates/biome_parser/src/lib.rs (6)
root
(839-841)root
(899-901)diagnostics
(66-68)diagnostics
(722-727)diagnostics
(880-882)diagnostics
(903-905)
crates/biome_service/src/workspace.rs (1)
crates/biome_service/src/workspace_types.rs (2)
SchemaGenerator
(521-521)SchemaGenerator
(522-522)
crates/biome_service/src/file_handlers/mod.rs (3)
crates/biome_html_syntax/src/file_source.rs (2)
svelte
(90-94)vue
(85-89)crates/biome_service/src/file_handlers/svelte.rs (1)
file_source
(67-80)crates/biome_service/src/file_handlers/vue.rs (1)
file_source
(67-80)
crates/biome_analyze/src/rule.rs (2)
crates/biome_analyze/src/diagnostics.rs (9)
severity
(66-71)category
(44-49)message
(57-64)description
(50-55)tags
(73-78)location
(80-87)advices
(89-101)record
(235-243)note
(186-189)crates/biome_parser/src/diagnostic.rs (7)
severity
(49-51)category
(37-39)message
(41-43)description
(45-47)location
(53-55)advices
(57-59)record
(114-146)
crates/biome_service/src/file_handlers/css.rs (2)
crates/biome_service/src/workspace/document.rs (3)
parse
(80-86)parse
(168-168)parse
(173-180)crates/biome_service/src/workspace/server.rs (1)
parse
(543-569)
crates/biome_json_parser/src/lib.rs (2)
crates/biome_parser/src/lib.rs (11)
syntax
(750-760)syntax
(847-857)syntax
(864-864)syntax
(926-931)syntax
(938-938)root
(839-841)root
(899-901)diagnostics
(66-68)diagnostics
(722-727)diagnostics
(880-882)diagnostics
(903-905)crates/biome_graphql_formatter/tests/language.rs (1)
parse
(23-27)
crates/biome_plugin_loader/src/analyzer_grit_plugin.rs (3)
crates/biome_service/src/workspace/document.rs (4)
parse
(80-86)parse
(168-168)parse
(173-180)new
(150-164)crates/biome_graphql_formatter/tests/language.rs (1)
parse
(23-27)crates/biome_parser/src/lib.rs (5)
new
(52-58)new
(835-837)new
(896-898)root
(839-841)root
(899-901)
crates/biome_service/src/file_handlers/graphql.rs (3)
crates/biome_service/src/file_handlers/html.rs (1)
parse
(361-375)crates/biome_service/src/workspace/document.rs (3)
parse
(80-86)parse
(168-168)parse
(173-180)crates/biome_service/src/workspace/server.rs (1)
parse
(543-569)
xtask/coverage/src/symbols/msts.rs (2)
crates/biome_formatter/src/lib.rs (3)
options
(754-754)options
(816-818)options
(1435-1435)crates/biome_js_parser/src/parser.rs (1)
options
(59-61)
crates/biome_service/src/workspace/document.rs (3)
crates/biome_service/src/workspace/server.rs (3)
diagnostics
(1321-1324)parse
(543-569)new
(119-141)crates/biome_parser/src/lib.rs (7)
diagnostics
(66-68)diagnostics
(722-727)diagnostics
(880-882)diagnostics
(903-905)into_serde_diagnostics
(729-734)into_serde_diagnostics
(868-873)into_serde_diagnostics
(907-912)crates/biome_service/src/file_handlers/html.rs (4)
node
(617-617)node
(625-625)node
(632-632)parse
(361-375)
crates/biome_service/src/file_handlers/javascript.rs (1)
crates/biome_service/src/workspace/document.rs (3)
parse
(80-86)parse
(168-168)parse
(173-180)
crates/biome_graphql_formatter/tests/language.rs (2)
crates/biome_service/src/workspace/document.rs (4)
new
(150-164)parse
(80-86)parse
(168-168)parse
(173-180)crates/biome_service/src/file_handlers/graphql.rs (1)
parse
(319-332)
crates/biome_parser/src/lib.rs (3)
crates/biome_service/src/workspace/server.rs (2)
diagnostics
(1321-1324)new
(119-141)crates/biome_service/src/workspace/document.rs (7)
from
(22-24)from
(28-30)from
(34-36)node
(167-169)into_serde_diagnostics
(112-118)into_serde_diagnostics
(172-181)new
(150-164)crates/biome_rowan/src/ast/mod.rs (1)
unwrap_cast
(199-211)
crates/biome_service/src/file_handlers/html.rs (4)
crates/biome_service/src/file_handlers/css.rs (15)
settings
(385-385)settings
(389-389)settings
(393-393)settings
(458-458)settings
(480-480)settings
(498-498)settings
(512-512)settings
(546-546)settings
(610-610)assist_enabled_for_file_path
(313-338)linter_enabled_for_file_path
(259-284)parse
(400-441)code_actions
(583-645)params
(653-653)params
(756-756)crates/biome_service/src/settings.rs (6)
check_feature_activity
(2006-2020)check_override_feature_activity
(2030-2038)assist_enabled_for_file_path
(673-673)assist_enabled_for_file_path
(1139-1144)linter_enabled_for_file_path
(667-667)linter_enabled_for_file_path
(1123-1128)crates/biome_service/src/file_handlers/json.rs (8)
workspace
(577-577)assist_enabled_for_file_path
(299-324)linter_enabled_for_file_path
(245-270)parse
(384-399)code_actions
(558-619)params
(510-510)params
(627-627)params
(732-732)crates/biome_service/src/workspace/document.rs (8)
from
(22-24)from
(28-30)from
(34-36)parse
(80-86)parse
(168-168)parse
(173-180)new
(150-164)node
(167-169)
crates/biome_service/src/file_handlers/astro.rs (2)
crates/biome_service/src/workspace/server.rs (1)
parse
(543-569)crates/biome_service/src/file_handlers/javascript.rs (1)
parse
(536-551)
crates/biome_service/src/file_handlers/grit.rs (3)
crates/biome_service/src/file_handlers/html.rs (1)
parse
(361-375)crates/biome_service/src/workspace/document.rs (3)
parse
(80-86)parse
(168-168)parse
(173-180)crates/biome_service/src/workspace/server.rs (2)
parse
(543-569)diagnostics
(1321-1324)
crates/biome_cli/tests/cases/html.rs (2)
crates/biome_cli/tests/main.rs (1)
run_cli
(332-347)crates/biome_cli/tests/snap_test.rs (1)
assert_cli_snapshot
(407-409)
crates/biome_service/src/workspace/server.rs (4)
crates/biome_service/src/file_handlers/mod.rs (7)
can_contain_embeds
(374-386)new
(539-553)new
(760-774)new
(1029-1047)new
(1337-1351)new
(1490-1500)capabilities
(739-741)crates/biome_service/src/file_handlers/html.rs (15)
node
(617-617)node
(625-625)node
(632-632)capabilities
(308-342)settings
(346-346)settings
(350-350)settings
(354-354)settings
(368-368)settings
(387-387)settings
(388-388)settings
(389-389)lint
(648-665)parse
(361-375)code_actions
(667-669)fix_all
(672-694)crates/biome_service/src/workspace/document.rs (6)
node
(167-169)file_source_index
(88-94)new
(150-164)parse
(80-86)parse
(168-168)parse
(173-180)crates/biome_service/src/projects.rs (1)
new
(392-396)
xtask/coverage/src/jsx/jsx_babel.rs (2)
crates/biome_formatter/src/lib.rs (3)
options
(754-754)options
(816-818)options
(1435-1435)crates/biome_js_parser/src/parser.rs (1)
options
(59-61)
crates/biome_css_parser/src/lib.rs (2)
crates/biome_json_parser/src/lib.rs (8)
new
(58-63)new
(159-161)diagnostics
(71-73)diagnostics
(188-190)syntax
(66-68)syntax
(183-185)from
(107-116)from
(214-223)crates/biome_parser/src/lib.rs (11)
root
(839-841)root
(899-901)diagnostics
(66-68)diagnostics
(722-727)diagnostics
(880-882)diagnostics
(903-905)syntax
(750-760)syntax
(847-857)syntax
(864-864)syntax
(926-931)syntax
(938-938)
crates/biome_js_transform/tests/spec_tests.rs (2)
xtask/coverage/src/runner.rs (1)
parse
(87-89)crates/biome_service/src/file_handlers/javascript.rs (1)
parse
(536-551)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (23)
- GitHub Check: Documentation
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Check Dependencies
- GitHub Check: Bench (biome_html_formatter)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: autofix
- GitHub Check: Bench (biome_html_parser)
- GitHub Check: Bench (biome_package)
- GitHub Check: Bench (biome_module_graph)
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Bench (biome_graphql_parser)
- GitHub Check: Bench (biome_css_parser)
- GitHub Check: Bench (biome_json_analyze)
- GitHub Check: Bench (biome_json_formatter)
- GitHub Check: Bench (biome_json_parser)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Bench (biome_css_formatter)
- GitHub Check: Bench (biome_css_analyze)
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: Bench (biome_graphql_formatter)
- GitHub Check: Bench (biome_js_parser)
🔇 Additional comments (49)
crates/biome_html_syntax/Cargo.toml (1)
22-24
: All tidy here. Nice to see the dev-deps wired in with path links; that keeps the workspace happy.crates/biome_js_parser/src/options.rs (1)
2-20
: Copy derive fits like a glove.Every field is already trivially copyable, so this trait just saves clones without any downsides. Nicely done.
crates/biome_service/src/file_handlers/vue.rs (1)
92-95
: Capability struct stays consistent.Keeping
parse_embedded_nodes
atNone
matches the current Vue handler behaviour and keeps the plumbing ready for future work.crates/biome_service/src/file_handlers/css.rs (2)
347-350
: Parser capability update looks tidy.Adding the new field keeps us aligned with the shared capabilities layout—no surprises here.
579-580
: Serde diagnostic hand-off is spot on.
into_serde_diagnostics
is the new name, and the call site still gets the same payload. All good.crates/biome_service/src/file_handlers/astro.rs (1)
78-81
: Astro capabilities in sync.The extra field slots in cleanly and keeps parity with the other handlers.
crates/biome_service/src/file_handlers/svelte.rs (1)
92-95
: Svelte handler aligned.Same pattern as Vue/Astro—future-proof without changing runtime behaviour.
crates/biome_js_transform/tests/spec_tests.rs (2)
95-111
: Bye-bye clones.Passing the parser options by value now that they’re
Copy
keeps the tests lean and mean.
166-169
: Reparse path still spotless.Re-using the same options by value is exactly what we needed—no behavioural change, just tidier code.
crates/biome_grit_patterns/src/grit_target_language/css_target_language/generated_mappings.rs (1)
202-214
: Tailwind variants wired up.Great to see the Tw nodes mapped; this keeps CSS grit patterns in lockstep with the syntax additions.
crates/biome_service/src/file_handlers/grit.rs (2)
249-252
: LGTM!Correct initialization of the new
parse_embedded_nodes
field toNone
, consistent with Grit not supporting embedded language parsing.
408-408
: LGTM!Correct migration to
into_serde_diagnostics()
aligning with the PR's diagnostic handling refactor.crates/biome_html_syntax/src/element_ext.rs (1)
151-168
: LGTM!The
is_javascript_module
implementation correctly identifies<script type="module">
tags by checking the script tag name and extracting/comparing the type attribute value.crates/biome_configuration/src/html.rs (2)
29-36
: LGTM!Consistent extension of
HtmlConfiguration
with linter and assist options following the established pattern for formatter configuration.
133-144
: LGTM!Properly structured
HtmlLinterConfiguration
with appropriate derives and serde annotations.xtask/coverage/src/symbols/msts.rs (1)
84-84
: LGTM!Correctly passes
JsParserOptions
by value now that it derivesCopy
, eliminating the unnecessary clone.crates/biome_grit_parser/src/lib.rs (1)
11-11
: LGTM!Correct migration to the new
NodeParse
-based conversion path forAnyParse
, consistent with the broader parser refactor across the codebase.Also applies to: 108-108
crates/biome_html_parser/src/lib.rs (1)
14-14
: LGTM!Correct adoption of the
NodeParse
-based conversion pattern, preserving the safety invariant comment for root node unwrapping.Also applies to: 108-113
xtask/coverage/src/runner.rs (1)
88-88
: LGTM!Correctly passes
JsParserOptions
by value, leveraging its newCopy
derivation to eliminate the clone.xtask/coverage/src/js/test262.rs (1)
103-104
: LGTM!The single-line construction aligns ownership semantics with the broader pattern across the coverage suite (JsParserOptions is now Copy).
crates/biome_js_analyze/tests/spec_tests.rs (1)
180-180
: LGTM!Removing
.clone()
in favour of by-value passing is appropriate now that JsParserOptions implements Copy.Also applies to: 205-205, 216-216, 235-235, 246-246
crates/biome_js_parser/src/parser.rs (1)
44-44
: LGTM!Passing options by value (Copy semantics) instead of cloning is cleaner and maintains equivalent behaviour.
xtask/coverage/src/ts/ts_babel.rs (1)
54-54
: LGTM!The by-value passing aligns with the Copy semantics of JsParserOptions across the coverage suite.
crates/biome_graphql_formatter/tests/language.rs (1)
7-7
: LGTM!The shift to NodeParse-centric construction aligns with the broader refactoring of parse result types across the PR.
Also applies to: 26-26
xtask/coverage/src/jsx/jsx_babel.rs (1)
48-48
: LGTM!The by-value passing aligns with the Copy semantics of JsParserOptions across the coverage suite.
crates/biome_service/src/file_handlers/json.rs (2)
339-342
: LGTM!Adding
parse_embedded_nodes: None
aligns JsonFileHandler with the updated ParserCapabilities structure across all file handlers.
539-539
: LGTM!The switch to
into_serde_diagnostics()
aligns with the serde-based diagnostics pathway used across other file handlers.crates/biome_service/src/settings.rs (1)
598-604
: LGTM!The newly enabled linter and assist configuration for HtmlConfiguration aligns with the PR objective of enabling diagnostics retrieval for HTML files.
crates/biome_yaml_parser/src/lib.rs (2)
1-1
: LGTM!Import required for the conversion path below.
97-102
: LGTM!Conversion path through
NodeParse
aligns with the broader refactor across parser crates.crates/biome_service/src/file_handlers/javascript.rs (2)
489-492
: LGTM!Added
parse_embedded_nodes
field to capabilities surface, correctly set toNone
for JavaScript handler.
771-771
: LGTM!Switched to
into_serde_diagnostics()
for lint results, aligning with the broader diagnostics refactor.crates/biome_service/src/workspace/server.tests.rs (2)
102-116
: LGTM!Test correctly adapts to the new
EmbeddedSnippets
API using filtering accessors.
132-132
: LGTM!Test fixture formatting updated to match expected output.
crates/biome_graphql_parser/src/lib.rs (2)
8-8
: LGTM!Import required for
NodeParse
conversion below.
103-108
: LGTM!Conversion path through
NodeParse
aligns with the broader parser refactor.crates/biome_parser/src/tree_sink.rs (1)
187-187
: LGTM!Tightened lifetime bound to
'static
aligns with offset-aware parsing requirements.crates/biome_js_parser/src/parse.rs (4)
8-8
: LGTM!Imports required for
NodeParse
andEmbeddedNodeParse
conversions below.
120-127
: LGTM!Conversion through
NodeParse
aligns with the broader parser refactor.
129-140
: LGTM!New
From<JsOffsetParse>
impl correctly usesEmbeddedNodeParse
for offset-aware parsing.
312-314
: LGTM!Changed
syntax()
to return ownedSyntaxNodeWithOffset
, consistent with Json/Css parsers.crates/biome_plugin_loader/src/analyzer_grit_plugin.rs (2)
13-13
: LGTM!Import required for
NodeParse
construction below.
77-77
: LGTM!Construction through
AnyParse::Node(NodeParse::new(...))
aligns with the new enum structure.crates/biome_service/src/file_handlers/graphql.rs (2)
274-277
: LGTM!Added
parse_embedded_nodes
field to capabilities, correctly set toNone
for GraphQL handler.
460-460
: LGTM!Switched to
into_serde_diagnostics()
for lint results, aligning with the broader diagnostics refactor.crates/biome_service/src/workspace/document.rs (2)
171-181
: Good: offset applied before serde conversionUsing
set_location_offset(self.content_offset)
ensures embedded code frames are shown at the right place. Nice.
218-232
: Format nodes adapter looks rightPlumbs range/source/parse per embedded snippet. No concerns.
crates/biome_parser/src/lib.rs (1)
721-734
: Serde diagnostics conversion split is sensibleKeeping
into_diagnostics
(raw) andinto_serde_diagnostics
(wrapped) lets the workspace apply offsets for embedded nodes later. Looks good.Also applies to: 867-874, 907-913
crates/biome_analyze/src/rule.rs (1)
1279-1283
: Advice offset setter is invoked
Embedded diagnostics already callset_advice_offset
.
@ematipico The test is failing because |
I will merge this one, but feel free to leave comments and I will eventually address them. I have another PR coming soon that will apply the "fix all" to snippets. |
It appears that |
)? | ||
} else { | ||
Default::default() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this could benefit from if-let
chaining.
let settings = self | ||
.projects | ||
.get_settings_based_on_path(project_key, path) | ||
.ok_or_else(WorkspaceError::no_project)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to revert this so that settings
is passed as an argument again instead of queried here, so that we don't do redundant lookups for the settings within a single workspace method. I did recently create a PR for this, so it's possible you had a merge conflict on this.
/// This function walks the HTML syntax tree to find all `<script>` and | ||
/// `<style>` elements and extracts their content for offset-aware | ||
/// parsing. | ||
fn get_language_snippets(&self, path: &Utf8Path) -> Vec<EmbeddedSnippets> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be a stand-alone method, but it's better to combine it with get_parse()
similar to what we do in get_parse_with_embedded_format_nodes()
. This avoids redundant lookups in the documents
hash map, and guarantees the state we access is actually atomic.
|
||
pub fn as_js_embedded_snippet(&self) -> Option<EmbeddedLanguageContent<JsLanguage>> { | ||
if let Self::Js(content) = self { | ||
Some(content.clone()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Methods prefixed with as_
should not clone per Rust conventions. This should either be called to_js_embedded_snippet()
, or preferably it should return a reference and leave the cloning or other usage to the caller.
/// Each entry contains the parsed JavaScript with offset-aware positioning | ||
/// relative to the parent HTML document. | ||
pub scripts: Vec<EmbeddedContent<JsLanguage>>, | ||
pub fn as_css_embedded_snippet(&self) -> Option<EmbeddedLanguageContent<CssLanguage>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. Either return a reference, or call it to_css_embedded_snippet()
. And similar for as_json_embedded_snippet()
below.
.and_then(|child| child.as_any_html_content().cloned()) | ||
.and_then(|child| child.as_html_embedded_content().cloned()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The clones can be avoided by moving them as assignments into the closure below, as the old code did.
let child = child.as_any_html_content()?;
let child = child.as_html_embedded_content()?;
.and_then(|child| child.as_any_html_content().cloned()) | ||
.and_then(|child| child.as_html_embedded_content().cloned()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These clones can be avoided too.
only, | ||
skip, | ||
only: only.clone(), | ||
skip: skip.clone(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can borrow these too?
) -> Result<Vec<EmbeddedSnippets>, WorkspaceError> { | ||
let mut embedded_nodes = Vec::new(); | ||
let capabilities = self.get_file_capabilities(path); | ||
let Some(parse_embedded) = capabilities.parser.parse_embedded_nodes else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet!
Summary
The works of this PR are two:
Parse and Analyzer diagnostics
Both
ParseDiagnostic
andAnalyzerDiagnostic
now have anadvice_offset
and aset_location_offset
method that is in charge of changing theTextRange
of theLocation
and the code frame of the advices.In order to implement this new feature, I implemented the following refactors:
Diagnostic
trait is now implemented viaimpl
and not via derive. That was required becauselocation
must be created dynamically. Plus,#[advice]
can't be used anymore due to the followingAdvise
trait must be implemented at the Diagnostic level, so we can readadvice_offset
and use it in case it is set when printing the code frames.Workspace snippets
Embedded nodes/snippets were parsed inside the
open_file_internal
using a custom logic (we checked if the file isHTML
). We don't do this anymore. We check ifDocumentFileSource::can_contain_embeds
, and iftrue
, we eventually call a new parse capability added in this PR. This parsing capability is implemented at the language level.This new architecture will allow us to parse other language snippets while keeping the Workspace implementation generic. For example, we will be able to parse snippets in JavaScript, such as CSS-in-JS, GraphQL queries, etc.
More refactors
AnyParse
is now an enum for the formerAnyParse
, now calledNodeParse
and a new variantEmbeddedNode
. This enum exposesunwrap_*
methods to "safely" pull root nodes or root embedded nodes while making methods inside the Workspace generic.into_diagnostics
has been renamed tointo_serde_diagnostics
EmbeddedSnippets
is now anenum
with language variants. This is now generic, and not HTML-centrichtml
configuration, so diagnostics can be pulledJsParseOption
are nowCopy
, which is in line with the other*ParseOption
of the other languagesMaking everything generic, as well as the pull of diagnostics, will allow us to implement the
fix_file
for embedded nodes too. I will do this in another PR, because it will require further changes, which I didn't want to add.Test Plan
Added new tests
Docs
Not needed for now