Replies: 1 comment 4 replies
-
When I first implemented it, I considered whether Dependency Injection (DI) was necessary. I concluded it wasn't, because supporting DI might complicate Ahead-of-Time (AOT) compilation, and manual creation could avoid DI altogether. I’ve already built a real-world server based on this approach. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Migrating from OmniSharp - it came with a DI support, via
.WithServices()
and theHandlers
were setup similarly with DI, such that the underlying services, that the LSP wraps, could be injected into the handlers.Do you have any recommendations on how to achieve this?
I'll need a DI service container either way as that is the only way to get to the afore mentioned underlying services as they in turn are very DI dependent.
At 10,000ft I'd figure one needs to:
WithServices
delegate such that the other services can be registered.IJsonHandler
that takes the type of the handler as the generic template, and the server as the constructor arg.Handle
implementations retrieve the actual handler from the DI container and delegate theHandle
calls.In this way the handler handler will get the request series injected.
If you think there is an appetite to accept an PR for this I may consider undertaking the work to build this into the base LanguageServer.
Beta Was this translation helpful? Give feedback.
All reactions