microsoft / microsoft/vscode-languageserver-node
Allow to register multiple handlers for shutdown
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.8k
- Forks
- 404
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 14
Description
After spending quite some time today tracking down a bug I noticed the cause was that vscode-languageserver does not allow to register more than one handler for shutdown, and subsequent calls will just override the previous handler silently:
This seems to also be true for exit and initialize.
I really wonder why the decision was made to provide an event-emitter like interface where you can register handlers at runtime (as opposed to a class/object that provides a single implementation for each method) if you can then only register one method handler for certain (?) methods.
Example use case: You want one connection to proxy or load-balance messages to different other servers. The proxy logic registers a handler for every message to forward them, but the cluster logic also registers a handler to shutdown to for example kill workers. Both handlers override each other.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at server/src/main.ts around the shutdown handler registration linked in the issue, then inspect the corresponding registration paths for exit and initialize. Done means multiple handlers can be registered for these events without silently replacing earlier handlers, with behavior covered by the relevant existing tests if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- backend-api-design, developer-experience
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100