use of org.eclipse.xtext.ide.server.ServerModule in project xtext-core by eclipse.
the class ServerLauncher method main.
public static void main(final String[] args) {
String _name = ServerLauncher.class.getName();
ServerModule _serverModule = new ServerModule();
ServerLauncher.launch(_name, args, _serverModule);
}
use of org.eclipse.xtext.ide.server.ServerModule in project xtext-core by eclipse.
the class MultiProjectTest method setup.
@Before
public void setup() {
ServerModule _serverModule = new ServerModule();
final Injector injector = Guice.createInjector(Modules2.mixin(_serverModule, new AbstractModule() {
@Override
protected void configure() {
this.<IWorkspaceConfigFactory>bind(IWorkspaceConfigFactory.class).to(MultiProjectWorkspaceConfigFactory.class);
}
}));
injector.injectMembers(this);
final File workspaceRoot = this.getRoot("test-data");
File _file = new File(workspaceRoot, "test-project0");
this.project0 = _file;
File _file_1 = new File(workspaceRoot, "test-project1");
this.project1 = _file_1;
this.project0.mkdir();
this.project1.mkdir();
final Procedure2<URI, Iterable<Issue>> _function = (URI $0, Iterable<Issue> $1) -> {
this.diagnostics.put($0, IterableExtensions.<Issue>toList($1));
};
this.workspaceManager.initialize(URI.createFileURI(workspaceRoot.getAbsolutePath()), _function, null);
}
use of org.eclipse.xtext.ide.server.ServerModule in project xtext-core by eclipse.
the class SocketServerLauncher method main.
public static void main(final String[] args) {
try {
ServerModule _serverModule = new ServerModule();
final Injector injector = Guice.createInjector(_serverModule);
final LanguageServer languageServer = injector.<LanguageServer>getInstance(LanguageServer.class);
final ServerSocketChannel serverSocket = ServerSocketChannel.open();
InetSocketAddress _inetSocketAddress = new InetSocketAddress("localhost", 5007);
serverSocket.bind(_inetSocketAddress);
final SocketChannel socketChannel = serverSocket.accept();
InputStream _newInputStream = Channels.newInputStream(socketChannel);
OutputStream _newOutputStream = Channels.newOutputStream(socketChannel);
PrintWriter _printWriter = new PrintWriter(System.out);
final Launcher<LanguageClient> launcher = LSPLauncher.createServerLauncher(languageServer, _newInputStream, _newOutputStream, true, _printWriter);
launcher.startListening().get();
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.ide.server.ServerModule in project xtext-core by eclipse.
the class AbstractLanguageServerTest method getServerModule.
protected com.google.inject.Module getServerModule() {
ServerModule _serverModule = new ServerModule();
final com.google.inject.Module _function = (Binder it) -> {
AnnotatedBindingBuilder<RequestManager> _bind = it.<RequestManager>bind(RequestManager.class);
_bind.toInstance(new RequestManager() {
@Override
public <V extends Object> CompletableFuture<V> runRead(final Function1<? super CancelIndicator, ? extends V> request) {
final CompletableFuture<V> result = new CompletableFuture<V>();
try {
final CancelIndicator _function = () -> {
return false;
};
result.complete(request.apply(_function));
} catch (final Throwable _t) {
if (_t instanceof Throwable) {
final Throwable e = (Throwable) _t;
result.completeExceptionally(e);
} else {
throw Exceptions.sneakyThrow(_t);
}
}
return result;
}
@Override
public <U extends Object, V extends Object> CompletableFuture<V> runWrite(final Function0<? extends U> nonCancellable, final Function2<? super CancelIndicator, ? super U, ? extends V> request) {
final CompletableFuture<V> result = new CompletableFuture<V>();
try {
final CancelIndicator _function = () -> {
return false;
};
result.complete(request.apply(_function, nonCancellable.apply()));
} catch (final Throwable _t) {
if (_t instanceof Throwable) {
final Throwable e = (Throwable) _t;
result.completeExceptionally(e);
} else {
throw Exceptions.sneakyThrow(_t);
}
}
return result;
}
});
};
return Modules2.mixin(_serverModule, _function);
}
use of org.eclipse.xtext.ide.server.ServerModule in project xtext-core by eclipse.
the class WorkspaceManagerTest method setup.
@Before
public void setup() {
try {
ServerModule _serverModule = new ServerModule();
final Injector injector = Guice.createInjector(_serverModule);
injector.injectMembers(this);
File _file = new File("./test-data/test-project");
this.root = _file;
boolean _mkdirs = this.root.mkdirs();
boolean _not = (!_mkdirs);
if (_not) {
Files.cleanFolder(this.root, null, true, false);
}
this.root.deleteOnExit();
final Procedure2<URI, Iterable<Issue>> _function = (URI $0, Iterable<Issue> $1) -> {
this.diagnostics.put($0, IterableExtensions.<Issue>toList($1));
};
this.workspaceManger.initialize(this.uriExtensions.withEmptyAuthority(URI.createFileURI(this.root.getAbsolutePath())), _function, null);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations