diff --git a/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/XMLServerLauncher.java b/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/XMLServerLauncher.java index 07c279751..840a8415b 100644 --- a/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/XMLServerLauncher.java +++ b/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/XMLServerLauncher.java @@ -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; @@ -55,8 +57,14 @@ protected PasswordAuthentication getPasswordAuthentication() { */ public static Future launch(InputStream in, OutputStream out) { XMLLanguageServer server = new XMLLanguageServer(); + Function wrapper; + if ("false".equals(System.getProperty("watchParentProcess"))) { + wrapper = it -> it; + } else { + wrapper = new ParentProcessWatcher(server); + } Launcher launcher = LSPLauncher.createServerLauncher(server, in, out, - Executors.newCachedThreadPool(), new ParentProcessWatcher(server)); + Executors.newCachedThreadPool(), wrapper); server.setClient(launcher.getRemoteProxy()); return launcher.startListening(); }