Search in sources :

Example 1 with XLanguageServerImpl

use of org.eclipse.n4js.xtext.ide.server.XLanguageServerImpl in project n4js by eclipse.

the class LspServer method setupAndRun.

private void setupAndRun(ExecutorService threadPool, XLanguageServerImpl languageServer) throws N4jscException, InterruptedException, ExecutionException, IOException {
    DebugService debugService = languageServer.getDebugService();
    Builder<LanguageClient> lsBuilder = new PatchedLauncherBuilder<LanguageClient>().setLocalService(languageServer).setRemoteInterface(LanguageClient.class).setExecutorService(threadPool).configureGson(gsonBuilder -> {
        gsonBuilder.registerTypeAdapterFactory(new ExecuteCommandParamsTypeAdapter.Factory(languageServer));
    }).wrapMessages(debugService.getTracingMessageWrapper());
    if (options.isStdio()) {
        setupAndRunWithSystemIO(languageServer, lsBuilder);
    } else {
        setupAndRunWithSocket(languageServer, lsBuilder);
    }
}
Also used : AsynchronousServerSocketChannel(java.nio.channels.AsynchronousServerSocketChannel) LspLogger(org.eclipse.n4js.xtext.ide.server.util.LspLogger) LanguageClient(org.eclipse.lsp4j.services.LanguageClient) XLanguageServerImpl(org.eclipse.n4js.xtext.ide.server.XLanguageServerImpl) N4jscFactory(org.eclipse.n4js.cli.N4jscFactory) AppenderSkeleton(org.apache.log4j.AppenderSkeleton) Logger(org.apache.log4j.Logger) Future(java.util.concurrent.Future) N4jscOptions(org.eclipse.n4js.cli.N4jscOptions) Appender(org.apache.log4j.Appender) Level(org.apache.log4j.Level) N4jscException(org.eclipse.n4js.cli.N4jscException) ExecuteCommandParamsTypeAdapter(org.eclipse.n4js.xtext.ide.server.ExecuteCommandParamsTypeAdapter) ExecutorService(java.util.concurrent.ExecutorService) AsynchronousSocketChannel(java.nio.channels.AsynchronousSocketChannel) OutputStream(java.io.OutputStream) PrintStream(java.io.PrintStream) Launcher(org.eclipse.lsp4j.jsonrpc.Launcher) Channels(java.nio.channels.Channels) SimpleLayout(org.apache.log4j.SimpleLayout) LoggingEvent(org.apache.log4j.spi.LoggingEvent) N4jscExitCode(org.eclipse.n4js.cli.N4jscExitCode) IOException(java.io.IOException) DebugService(org.eclipse.n4js.xtext.ide.server.DebugService) InetSocketAddress(java.net.InetSocketAddress) Executors(java.util.concurrent.Executors) ExecutionException(java.util.concurrent.ExecutionException) Injector(com.google.inject.Injector) Futures(com.google.common.util.concurrent.Futures) ServerIncidentLogger(org.eclipse.n4js.xtext.ide.server.util.ServerIncidentLogger) Writer(java.io.Writer) WriterAppender(org.apache.log4j.WriterAppender) Builder(org.eclipse.lsp4j.jsonrpc.Launcher.Builder) Layout(org.apache.log4j.Layout) N4jscConsole(org.eclipse.n4js.cli.N4jscConsole) ProjectStatePersisterConfig(org.eclipse.n4js.xtext.ide.server.ProjectStatePersisterConfig) InputStream(java.io.InputStream) Joiner(com.google.common.base.Joiner) DebugService(org.eclipse.n4js.xtext.ide.server.DebugService) LanguageClient(org.eclipse.lsp4j.services.LanguageClient) N4jscFactory(org.eclipse.n4js.cli.N4jscFactory)

Example 2 with XLanguageServerImpl

use of org.eclipse.n4js.xtext.ide.server.XLanguageServerImpl in project n4js by eclipse.

the class LspServer method performLifecycle.

private void performLifecycle(ExecutorService threadPool) throws N4jscException, InterruptedException, ExecutionException, IOException {
    setPersistionOptions();
    XLanguageServerImpl languageServer = N4jscFactory.getLanguageServer();
    setupAndRun(threadPool, languageServer);
    N4jscFactory.resetInjector();
}
Also used : XLanguageServerImpl(org.eclipse.n4js.xtext.ide.server.XLanguageServerImpl)

Aggregations

XLanguageServerImpl (org.eclipse.n4js.xtext.ide.server.XLanguageServerImpl)2 Joiner (com.google.common.base.Joiner)1 Futures (com.google.common.util.concurrent.Futures)1 Injector (com.google.inject.Injector)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 PrintStream (java.io.PrintStream)1 Writer (java.io.Writer)1 InetSocketAddress (java.net.InetSocketAddress)1 AsynchronousServerSocketChannel (java.nio.channels.AsynchronousServerSocketChannel)1 AsynchronousSocketChannel (java.nio.channels.AsynchronousSocketChannel)1 Channels (java.nio.channels.Channels)1 ExecutionException (java.util.concurrent.ExecutionException)1 ExecutorService (java.util.concurrent.ExecutorService)1 Executors (java.util.concurrent.Executors)1 Future (java.util.concurrent.Future)1 Appender (org.apache.log4j.Appender)1 AppenderSkeleton (org.apache.log4j.AppenderSkeleton)1 Layout (org.apache.log4j.Layout)1