Wrap LSPAny over JToken with structural equality, add ref to STJ#74
Open
razzmatazz wants to merge 4 commits into
Open
Wrap LSPAny over JToken with structural equality, add ref to STJ#74razzmatazz wants to merge 4 commits into
razzmatazz wants to merge 4 commits into
Conversation
…quality This is to enable mechanical conversion of the codebase to support System.Text.Json by replacing JToken with JsonElement.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Preparation for #73. This PR can be treated as RFC, as well.
LSPAnywas a bareJTokenalias —JObject/JArrayhave a brokenGetHashCodeandJsonElement(the intended future backing type) provides neither equality nor hashing. This PR introduces a thin wrapper withEquals/GetHashCodeviaJToken.DeepEqualsand aLSPAnyConverterfor transparent serialization, and updatesserialize/deserializeto produce/consumeLSPAnydirectly.The wrapper also exposes
fromJToken/fromJsonElementfactory members and aJsonElementproperty (bridged via raw JSON text for now), backed by a newSystem.Text.Json10.0.8 package reference (which includes anetstandard2.0target). This makesLSPAnythe single migration seam: swapping the internal backing fromJTokentoJsonElementwill only touch the inside of this type.