lsp icon indicating copy to clipboard operation
lsp copied to clipboard

Support re-entrant sessions that talk to the same server

Open isovector opened this issue 4 years ago • 5 comments

In the Wingman test suite, I have 100+ golden tests. Currently, every one of them needs to spin up and subsequently tear down the server, which seems like a lot of wasted effort. I'd like to spin up a server before the first test runs, and have each test communicate with the same server.

I tried to roll my own, but running a Session is very opinionated about killing the server when it's done.

isovector avatar Apr 08 '21 00:04 isovector

I think it's up to the test framework, whereas lsp-test can't do much. For your case, is it possible to spawn a worker thread with TQueue, executing Sessions sent from test cases?

berberman avatar Apr 08 '21 04:04 berberman

In general, not spawn a new session for each test would make hls test suite lot faster :thinking:

jneira avatar Apr 08 '21 05:04 jneira

@berberman AFAICT, the problem is that runSession explicitly asks the server to shut down when it's finished, which prevents users from working around this issue in application code

isovector avatar Apr 08 '21 06:04 isovector

@isovector I came up with a naive implementation: https://github.com/haskell/haskell-language-server/compare/master...berberman:test-session-queue

But I didn't observe improvements running it locally, and it seemd that memory usage was even worse. Perhaps I missed something, or there is a leak.

berberman avatar Apr 08 '21 08:04 berberman

Ahh, that's a clever solution; I completely misunderstood your suggestion. Sorry about that. I'll investigate tomorrow morning!

isovector avatar Apr 08 '21 09:04 isovector