x icon indicating copy to clipboard operation
x copied to clipboard

fix(powernap): use req.Notif to detect notifications in Router

Open lexh opened this issue 9 months ago • 0 comments

Router.Route compared req.ID to jsonrpc2.ID{} to distinguish notifications from requests. Since jsonrpc2.ID{} has Num: 0, any server-initiated request with integer ID 0 (e.g. the first outgoing request from lsp_server/ty) was misrouted as a notification, skipping its registered handler entirely.

Use req.Notif instead, which is correctly set by Request.UnmarshalJSON based on whether the "id" field is present in the JSON.

Also guard against nil req.Params to prevent panics when a server sends a request or notification without a params field.

  • [x] I have read CONTRIBUTING.md.
  • [ ] I have created a discussion that was approved by a maintainer (for new features).

lexh avatar Mar 02 '26 18:03 lexh