This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
feat(rome_diagnostics): refactor some existing diagnostics to use the new Diagnostic trait #3315
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR holds a number of miscellaneous changes related to exposing the new diagnostic system to the node.js API.
The central change to enable this is replacing the
rome_diagnostics::Diagnostic
type in the result of thepull_diagnostics
Workspace method with the newrome_diagnostics::v2::serde::Diagnostic
type, the serializable form of the newDiagnostic
trait.In order to make this work I had to fix a few bugs around the serialization and lifetime of diagnostic categories.
I also updated the logic that turns Rome diagnostics into LSP diagnostics to be generic over the Diagnostic trait, and changed the error reporting in the CLI filesystem traversal logic to use the new
Error
type provided byrome_diagnostics
instead of declaring its ownTraversalError
.Test Plan
The changes in the filesystem traversal should be covered by the CLI snapshot tests, and I've added an additional test to check how diagnostics are encoded to the LSP