Add base protocol Message types#3
Merged
Merged
Conversation
Implements the LSP 3.17 base protocol abstract Message and its concrete forms: - Message — abstract base carrying `jsonrpc`; BaseRequest and BaseNotification now subclass it. - ResponseMessage / ResponseError — the response side of the protocol, with a nullable id and exclusive result/error fields. - ErrorCodes — JSON-RPC and LSP-defined error code constants (IntEnum). - RequestMessage / NotificationMessage — spec-named aliases for the existing BaseRequest / BaseNotification. Exports the new types from the package root and adds protocol tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
christiankissig
added a commit
that referenced
this pull request
Jul 7, 2026
Add base protocol Message types
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.
Summary
Adds the base protocol abstract
Messageand its concrete message forms from LSP 3.17 toprotocol.py:Message— the abstract base carrying onlyjsonrpc.BaseRequestandBaseNotificationnow subclass it (so every message type shares the common root), with no change to their serialized output.ResponseMessage— the response side of the protocol: a nullableid(int | str | None, per the spec it may benullwhen the id can't be determined) plus mutually-exclusiveresult/errorfields.ResponseError—code/message/ optionaldata.ErrorCodes— the JSON-RPC and LSP-defined error code constants as anIntEnum(ParseError,MethodNotFound,RequestCancelled, the reserved-range markers, etc.). Codes that share a value resolve to enum aliases.RequestMessage/NotificationMessage— spec-named aliases for the existingBaseRequest/BaseNotification.All new types are exported from the package root.
Testing
Messagebase, the request/notification subclassing relationship, success/error/null-id responses, and error-code values/aliases.ruff check,ruff format --check,mypy, and fullpytest(32 passed) all pass locally.🤖 Generated with Claude Code