Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [lsp4e-dev] Looking for cookbook for adding new LSPs



On Tue, Aug 20, 2019 at 12:44 PM David Goodenough <david.goodenough@xxxxxxxxxxxxxxxxxxxx> wrote:
if I have an LSP which is written in Java (or at least compiled into Java Bytecode) am I better to run it as a separate process or to try to run it within Eclipse?

It depends on your constraints and priority.
Trying to run it inside the same JVM will most likely save some RAM and improve the startup performance (many classes already loaded in the LS) and can help reduce the weight of the delivery (as you can reuse many APIs already part of Eclipse IDE), however it would be a thread inside the same JVM so the performance could be affected by other parts of the IDE. The drawbacks are the opposite of the next paragraph.
Keeping it as a separate process provides separation/isolation, easier debugging, more control from OS on the LS (you can kill it separately), and if can actually perform better as a separate process than a thread in a crowded application. The drawbacks are the opposite of previous paragraph.
I suggest that you start by implementing it as a separate process in a separate JVM instance first. Then, when things start to work, you'll have more input to decide whether a thread is worth it.
 
If the latter, what do I have to define?

You need to replace the ProcessStreamConnectionProvider by a generic StreamConnectionProvider and start your LS in a thread instead of a process. If you're using LSP4J, just invoke the Laucher.createServer(...) from the StreamConnectionProvider.

HTH

Back to the top