Skip to content
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

refactor(biome_deserialize): add deserilization context #4166

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

Conaclos
Copy link
Member

@Conaclos Conaclos commented Oct 2, 2024

Summary

This is a BREAKING CHANGE for library consumers.

This implements the design proposed in this comment.

The context allows reporting diagnostics and to retrieve the identifier of the root object.
The identifier can be anything. It can notably be the path to the deserialized file: what was requested here.

Note that deserialize_from_json_str and deserialize_from_json_ast last argument was previously passed as name to the deserializer.
It is now used as identifier.
The name of the root deserializer is always set to the empty string.

Also I removed the passthrough_name derive macro attribute. This attribute was introduced to allow to pass a name between deserializers. It is no longer needed since we have ctx.id().

NOTE: we no longer need this refactor. However, this could be good to merge.
We should check with our library consumers if it is something they still require.

Test Plan

CI must pass.

@github-actions github-actions bot added A-CLI Area: CLI A-Project Area: project A-Linter Area: linter A-Formatter Area: formatter A-Tooling Area: internal tools L-JavaScript Language: JavaScript and super languages labels Oct 2, 2024
Copy link
Contributor

github-actions bot commented Oct 2, 2024

Parser conformance results on

js/262

Test result main count This PR count Difference
Total 48517 48517 0
Passed 47326 47326 0
Failed 1191 1191 0
Panics 0 0 0
Coverage 97.55% 97.55% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 40 40 0
Passed 37 37 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.50% 92.50% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 6574 6574 0
Passed 2203 2203 0
Failed 4371 4371 0
Panics 0 0 0
Coverage 33.51% 33.51% 0.00%

ts/babel

Test result main count This PR count Difference
Total 680 680 0
Passed 608 608 0
Failed 72 72 0
Panics 0 0 0
Coverage 89.41% 89.41% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 18473 18473 0
Passed 14146 14146 0
Failed 4327 4327 0
Panics 0 0 0
Coverage 76.58% 76.58% 0.00%

@Conaclos Conaclos force-pushed the conaclos/deserialize-context branch from dd0d54c to 016732b Compare October 2, 2024 15:04
Copy link

codspeed-hq bot commented Oct 2, 2024

CodSpeed Performance Report

Merging #4166 will not alter performance

Comparing conaclos/deserialize-context (f024c39) with next (2481b08)

Summary

✅ 101 untouched benchmarks

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually, breaking changes should be presented with a clear migration path for users.

I know that we don't have a changelog for the crate yet, but maybe we should. As for now, I think we should have at least a migration path in the description of the PR.

crates/biome_deserialize/src/lib.rs Outdated Show resolved Hide resolved
@ematipico ematipico dismissed their stale review October 3, 2024 10:49

Not intended

@ematipico
Copy link
Member

Can you point this to next instead? So we can create a changeset for biome_deserialize

@github-actions github-actions bot added A-Core Area: core A-Parser Area: parser A-LSP Area: language server protocol L-CSS Language: CSS L-JSON Language: JSON and super languages L-Grit Language: GritQL labels Oct 22, 2024
@Conaclos Conaclos changed the base branch from main to next October 22, 2024 15:14
@github-actions github-actions bot removed A-Core Area: core A-Parser Area: parser A-LSP Area: language server protocol L-CSS Language: CSS L-Grit Language: GritQL labels Oct 22, 2024
@Conaclos Conaclos force-pushed the conaclos/deserialize-context branch 2 times, most recently from 2da418c to 0a7d005 Compare October 22, 2024 16:07
@Conaclos Conaclos changed the title refactor: add deserilization context refactor(biome_deserialize): add deserilization context Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: CLI A-Formatter Area: formatter A-Linter Area: linter A-Project Area: project A-Tooling Area: internal tools L-JavaScript Language: JavaScript and super languages L-JSON Language: JSON and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants