Skip to content

Commit

Permalink
Make ParentProcessWatcher optional
Browse files Browse the repository at this point in the history
Signed-off-by: Snjezana Peco <[email protected]>
  • Loading branch information
snjeza authored and fbricon committed Mar 18, 2019
1 parent afdfd18 commit 28b1b89
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
import java.net.PasswordAuthentication;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.function.Function;

import org.eclipse.lsp4j.jsonrpc.Launcher;
import org.eclipse.lsp4j.jsonrpc.MessageConsumer;
import org.eclipse.lsp4j.launch.LSPLauncher;
import org.eclipse.lsp4j.services.LanguageClient;
import org.eclipse.lsp4xml.commons.ParentProcessWatcher;
Expand Down Expand Up @@ -55,8 +57,14 @@ protected PasswordAuthentication getPasswordAuthentication() {
*/
public static Future<?> launch(InputStream in, OutputStream out) {
XMLLanguageServer server = new XMLLanguageServer();
Function<MessageConsumer, MessageConsumer> wrapper;
if ("false".equals(System.getProperty("watchParentProcess"))) {
wrapper = it -> it;
} else {
wrapper = new ParentProcessWatcher(server);
}
Launcher<LanguageClient> launcher = LSPLauncher.createServerLauncher(server, in, out,
Executors.newCachedThreadPool(), new ParentProcessWatcher(server));
Executors.newCachedThreadPool(), wrapper);
server.setClient(launcher.getRemoteProxy());
return launcher.startListening();
}
Expand Down

0 comments on commit 28b1b89

Please sign in to comment.