Skip to content

Add base protocol Message types#3

Merged
christiankissig merged 1 commit into
masterfrom
add-message-base
Jun 3, 2026
Merged

Add base protocol Message types#3
christiankissig merged 1 commit into
masterfrom
add-message-base

Conversation

@christiankissig

Copy link
Copy Markdown
Owner

Summary

Adds the base protocol abstract Message and its concrete message forms from LSP 3.17 to protocol.py:

  • Message — the abstract base carrying only jsonrpc. BaseRequest and BaseNotification now 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 nullable id (int | str | None, per the spec it may be null when the id can't be determined) plus mutually-exclusive result / error fields.
  • ResponseErrorcode / message / optional data.
  • ErrorCodes — the JSON-RPC and LSP-defined error code constants as an IntEnum (ParseError, MethodNotFound, RequestCancelled, the reserved-range markers, etc.). Codes that share a value resolve to enum aliases.
  • RequestMessage / NotificationMessage — spec-named aliases for the existing BaseRequest / BaseNotification.

All new types are exported from the package root.

Testing

  • 6 new protocol tests (32 total) covering the Message base, the request/notification subclassing relationship, success/error/null-id responses, and error-code values/aliases.
  • ruff check, ruff format --check, mypy, and full pytest (32 passed) all pass locally.

🤖 Generated with Claude Code

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 christiankissig merged commit 0eb8004 into master Jun 3, 2026
7 checks passed
@christiankissig christiankissig deleted the add-message-base branch June 3, 2026 17:03
christiankissig added a commit that referenced this pull request Jul 7, 2026
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