Skip to content

Migrate Pylance client to LanguageServer.Protocol.Internal (depends on #8672) - #8671

Draft
kayle wants to merge 2 commits into
microsoft:mainfrom
kayle:dev/kayle/ptvs-protocol-migration
Draft

kayle wants to merge 2 commits into
microsoft:mainfrom
kayle:dev/kayle/ptvs-protocol-migration

Conversation

@kayle

@kayle kayle commented Nov 17, 2026 •

Copy link
Copy Markdown

Depends on #8672. This branch includes #8672's commit f487374 (STJ middle layer/serialization on public Protocol 18.14.2); review only the top commit 246a6de. Retarget/rebase after #8672 merges.

Migrates the VS 18 Pylance language client (in-process C# ILanguageClient; Pylance itself is unchanged) from Microsoft.VisualStudio.LanguageServer.Protocol to Microsoft.VisualStudio.LanguageServer.Protocol.Internal.

Changes

  • Build/18.0/packages.config: Protocol 18.14.2 → Protocol.Internal 18.14.12, plus the versions its nuspec requires (Text/CoreUtility 18.14.8, Threading 18.13.4, Validation 18.7.19, Composition 18.9.55, Nerdbank.MessagePack 1.2.34, System.Collections.Immutable 10.0.10, and transitive packages). Client stays at 18.0.14-preview (its assemblies reference neither legacy Protocol nor Extensions).
  • PreBuild.ps1 symlink, Core.csproj VSIX content, and PythonTools/PythonToolsTests references now use the Internal assembly.
  • Code adaptations to Internal's API shape: union .Value pattern matching for CompletionItem.Documentation/TextEdit, FileEvent.Type, Command.CommandValue, Requests/Notifications method constants, TextDocumentContentChangePartial wrapped in TextDocumentContentChangeEvent, and using-aliases for PTVS DTOs whose names Internal now also defines. Wire JSON is unchanged.
  • ProtocolJsonSerializerOptions.Configure is applied to PTVS's own STJ options (ProtocolJsonSerialization.Options). No access to JsonRpc.MessageHandler/formatter internals (the earlier revision's inaccessible usage is gone); the host-owned JsonRpc path relies on Internal's attribute-applied union converters.

Remaining limitations

  • Typed requests/notifications sent through the host-owned JsonRpc use the host formatter's options, which PTVS cannot configure publicly. Internal's attribute-applied union converters round-trip under plain STJ options, but this path hasn't been exercised in an installed VS.
  • A full MSBuild/VSIX build was not run locally; installed VS runtime compatibility with Internal 18.14.12 and its dependency versions is not proven.
  • Internal is only restorable from the internal VS-CoreXtFeeds source (added by Use System.Text.Json throughout the Pylance language client #8672).
  • Build/16.0 and Build/17.0 packages.config still pin the legacy Protocol; those targets can't build the STJ client after Use System.Text.Json throughout the Pylance language client #8672 anyway.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Use public Protocol 18.14.2 and its required JSON dependencies while preserving the editor-facing protocol APIs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replace the public Protocol 18.14.2 package with Protocol.Internal 18.14.12 and its dependency graph for VS 18, update the symlink, VSIX content and references, adapt to Internal's union, FileEvent, Command, method-name and content-change APIs, and apply ProtocolJsonSerializerOptions.Configure to the PTVS-owned STJ options.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@kayle
kayle force-pushed the dev/kayle/ptvs-protocol-migration branch from 9dc2e67 to 246a6de Compare November 17, 2026 16:05
@kayle kayle changed the title Migrate PTVS VS 18 to Internal protocol package Migrate Pylance client to LanguageServer.Protocol.Internal (depends on #8672) Nov 17, 2026
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant