Import Ionide.LSP, convert to STJ - #367
Merged
Merged
Conversation
razzmatazz
force-pushed
the
use-system-text-json-v
branch
8 times, most recently
from
May 27, 2026 06:22
3b27981 to
9037b13
Compare
razzmatazz
force-pushed
the
use-system-text-json-v
branch
8 times, most recently
from
June 4, 2026 07:32
5d54c8e to
c6bd0e0
Compare
razzmatazz
force-pushed
the
use-system-text-json-v
branch
2 times, most recently
from
August 16, 2026 13:25
2a7203b to
e0d8467
Compare
…ext.Json Rewrite OptionConverter.fs, JsonUtils.fs, and LanguageServerProtocol.fs to add System.Text.Json-based converters (FSharpOptionConverter, ErasedUnionConverter, SingleCaseUnionConverter, EnumMemberConverter, JTokenJsonConverter) alongside the existing Newtonsoft.Json ones. Server.serialize/deserialize now go through a new lspSerializerOptions (STJ) via LSPAny.JsonElement/LSPAny.fromJsonElement, while defaultJsonRpcFormatter, Server.start*, and the Client module remain Newtonsoft-based for the StreamJsonRpc wire path. 🤖 Generated with [ECA](https://eca.dev) (anthropic/claude-sonnet-5) Co-Authored-By: eca-agent <git@eca.dev>
…chitecture Rewrite the plan doc to describe what actually shipped: LSPAny stays a wrapper class (from origin/main's existing Ionide.LSP import) rather than becoming a raw JsonElement alias, with STJ converters (LSPAnyJsonConverter, JTokenJsonConverter, and friends) added alongside the existing Newtonsoft ones. Server.serialize/ deserialize now use System.Text.Json via the LSPAny.JsonElement bridge, while defaultJsonRpcFormatter/Server.start*/Client stay Newtonsoft-based and untouched. Mark the originally-planned codegen/JsonRpc.fs/shim-removal phases as superseded since they were already satisfied on origin/main via a different mechanism. 🤖 Generated with [ECA](https://eca.dev) (anthropic/claude-sonnet-5) Co-Authored-By: eca-agent <git@eca.dev>
Replace remaining JToken/JObject usage in the CSharpLanguageServer project and its tests with System.Text.Json equivalents (JsonElement/JsonNode), and remove the Newtonsoft.Json PackageReference from the fsproj. Newtonsoft remains a transitive dependency via Ionide.LanguageServerProtocol, which is unaffected by this change. 🤖 Generated with [ECA](https://eca.dev) (anthropic/claude-sonnet-5) Co-Authored-By: eca-agent <git@eca.dev>
razzmatazz
force-pushed
the
use-system-text-json-v
branch
from
August 18, 2026 06:41
e69c58b to
8a40c8d
Compare
csharp-ls's own code was already Newtonsoft-free. This adds a direct Newtonsoft.Json PackageReference with ExcludeAssets="runtime" so the DLL that flows in transitively via StreamJsonRpc (through Ionide.LanguageServerProtocol) is no longer copied into the build/publish output, matching the existing pattern used for Microsoft.Build/ NuGet.Frameworks. Verified via `dotnet publish` that Newtonsoft.Json.dll and any mention of it in CSharpLanguageServer.deps.json are both gone. Also: - CodeLens.fs: use the existing STJ-based `deserialize` helper instead of `LSPAny.JToken.ToObject<...>` to resolve CodeLens data. - Small comment fixes (Lsp/Client.fs, Handlers/Workspace.fs) that referenced Newtonsoft terminology no longer accurate once Ionide.LanguageServerProtocol's LSPAny becomes JsonElement-backed. - DiagnosticTests.fs: replace direct `LSPAny.JToken`/`fromJToken` usage with `LSPAny.JsonElement`/`fromJsonElement` (STJ) equivalents. - docs/plans updated to describe the new state. 🤖 Generated with [ECA](https://eca.dev) (anthropic/claude-sonnet-5) Co-Authored-By: eca-agent <git@eca.dev>
…ship it Stops shipping Newtonsoft.Json.dll with csharp-ls: the vendored Ionide.LanguageServerProtocol.fsproj no longer references the package. Its remaining consumers are disabled, not deleted — guarded behind `#if NEWTONSOFT_LEGACY_UNUSED ... #endif` (a symbol that is never defined), so the code stays in the tree and can be re-enabled by defining that symbol and re-adding the package reference: - Server.defaultJsonRpcFormatter / Server.start* (start/startWs/ startWithSetup/startWithSetupWs) / Server.defaultRpc, and the hand-rolled Client module in LanguageServerProtocol.fs — confirmed unused anywhere in csharp-ls or its tests (csharp-ls uses its own Runtime/JsonRpc.fs transport instead). - JsonRpc.Request/Notification/Response/MessageTypeTest — only used by the now-disabled Client module. - The Newtonsoft-only converters in JsonUtils.fs/OptionConverter.fs that only fed the disabled formatter. What had to change for real (not just guarded), since it's on the live STJ path csharp-ls actually uses: - LSPAny (Types.fs) is now backed directly by System.Text.Json.JsonElement instead of bridging through Newtonsoft.Json.Linq.JToken. - JsonRpc.Error.Data is now JsonElement option instead of JToken option. - Types.cg.fs (generated) and its generator (tools/MetaModelGenerator/GenerateTypes.fs) no longer emit JToken-typed fields or the inert Newtonsoft [<JsonProperty>]/ [<JsonConverter(StringEnumConverter)>] attributes; [<JsonIgnore>] on generated DebuggerDisplay members now resolves to STJ's attribute instead of Newtonsoft's, so it's actually honoured. `dotnet build`/`dotnet test` pass in full (282/282), and `dotnet publish` confirms Newtonsoft.Json.dll is absent from the output. 🤖 Generated with [ECA](https://eca.dev) (anthropic/claude-sonnet-5) Co-Authored-By: eca-agent <git@eca.dev>
…ip it Extends the NEWTONSOFT_LEGACY_UNUSED guard (previously only covering the Newtonsoft.Json wire path) over the remaining StreamJsonRpc-based Server.startWithSetupCore/Server.start* transport and the generated Mappings.routeMappings, then drops the StreamJsonRpc package reference entirely. The code itself is left untouched behind the #if so it stays easy to diff/merge against upstream; only the generator gained a small post-processing step to keep re-guarding ClientServer.cg.fs on every regeneration. csharp-ls no longer restores or ships StreamJsonRpc, Newtonsoft.Json, MessagePack, Nerdbank.Streams, or Microsoft.VisualStudio.Threading/Validation (and their resource satellites), shrinking the published tool by ~3MB with no ExcludeAssets workaround needed. 🤖 Generated with [ECA](https://eca.dev) (anthropic/claude-sonnet-5) Co-Authored-By: eca-agent <git@eca.dev>
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.
No description provided.