Skip to content

Conversation

@csacca
Copy link

@csacca csacca commented Nov 3, 2025

Summary

  • powernap advertises workspaceFolders but didn’t handle the server-initiated workspace/workspaceFolders request. Some servers (e.g., MATLAB-language-server) call it early and hit ‘no handler’.
  • Router.Route also dereferenced nil params, so requests/notifications without params could panic.

Changes

  • lsp/client.go: register a handler for workspace/workspaceFolders that returns the configured folders or [].
  • transport/router.go: make params nil-safe for both requests and notifications.

Tests

  • Added coverage for handler registration and behavior, plus nil params in the router:
    • powernap/pkg/lsp/{client_setup_test.go,client_workspacefolders_test.go,client_workspacefolders_negative_test.go,client_workspacefolders_e2e_test.go,testutil_test.go}
    • powernap/pkg/transport/router_test.go

Verification

  • GOTOOLCHAIN=go1.24.5 go test ./powernap/...
  • Optional: run against a server that calls workspace/workspaceFolders with no params; no error/panic, folders returned.

Notes

… params nil-safe

- Register handler for server-initiated workspace/workspaceFolders to return configured folders (or empty).
- Guard Router.Route against nil Params for both requests and notifications to avoid panics.
- Add tests covering handler registration and nil Params behavior.
@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.62%. Comparing base (4542a18) to head (46ca69d).
⚠️ Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
powernap/pkg/lsp/client.go 50.00% 1 Missing and 2 partials ⚠️
powernap/pkg/transport/router.go 50.00% 2 Missing and 1 partial ⚠️

❗ There is a different number of reports uploaded between BASE (4542a18) and HEAD (46ca69d). Click for more details.

HEAD has 70 uploads less than BASE
Flag BASE (4542a18) HEAD (46ca69d)
73 3
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #611       +/-   ##
==========================================
- Coverage   31.33%   0.62%   -30.71%     
==========================================
  Files         160      14      -146     
  Lines       14433    4137    -10296     
==========================================
- Hits         4523      26     -4497     
+ Misses       9628    4108     -5520     
+ Partials      282       3      -279     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

powernap advertises workspace/workspaceFolders but lacks handler; router panics on nil params

1 participant