Skip to content

Do not send params for notifications without parameters - #1945

Open
Ilya Trapashko (itrapashko) wants to merge 1 commit into
microsoft:mainfrom
itrapashko:fix/send-notification0-params
Open

Ilya Trapashko (itrapashko) wants to merge 1 commit into
microsoft:mainfrom
itrapashko:fix/send-notification0-params

Conversation

@itrapashko

Copy link
Copy Markdown
Contributor

Fixes #1944

The wrapper now forwards only the parameters that were actually passed, as sendRequest does. [any?] is used instead of any[] so that the spread matches the (method) and (method, params) overloads of ProtocolConnection.

A notification with an explicit undefined parameter (e.g. NotificationType<void>) is still sent as [null].

Copilot AI balanced review requested due to automatic review settings November 13, 2026 14:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the change preserving omitted notification parameters.

No open issues 🎉

What changed in this PR

Fixes #1944 by preserving omitted notification parameters in the server connection wrapper, preventing parameterless notifications from being sent with params: [null].

Changes:

  • Forward only supplied notification arguments, matching the sendRequest wrapper.
  • Preserve existing behavior for explicitly passed undefined.
  • Add a regression test confirming that parameterless notifications deliver zero arguments.
File Description
server/​src/​node/​test/​connection.test.ts Adds regression coverage for notifications without parameters.
server/​src/​common/​server.ts Uses an optional rest tuple to preserve the number of supplied arguments.

Review effort: Balanced

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.

Notification with 0 params is sent with 1 param

2 participants