org.eclipse.xtext.ide.server.ServerModule Java Examples

The following examples show how to use org.eclipse.xtext.ide.server.ServerModule. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultiProjectTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Before
public void setup() {
  ServerModule _serverModule = new ServerModule();
  final Injector injector = Guice.createInjector(Modules2.mixin(_serverModule, new AbstractModule() {
    @Override
    protected void configure() {
      this.<IMultiRootWorkspaceConfigFactory>bind(IMultiRootWorkspaceConfigFactory.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);
}
 
Example #2
Source File: WorkspaceManagerTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@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);
  }
}
 
Example #3
Source File: SocketServerLauncher.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
	Injector injector = Guice.createInjector(new ServerModule());
	LanguageServer languageServer = injector.getInstance(LanguageServer.class);
	ServerSocketChannel serverSocket = ServerSocketChannel.open();
	serverSocket.bind(new InetSocketAddress("localhost", 5007));
	SocketChannel socketChannel = serverSocket.accept();
	Launcher<LanguageClient> launcher = LSPLauncher.createServerLauncher(languageServer, Channels.newInputStream(socketChannel), Channels.newOutputStream(socketChannel), true, new PrintWriter(System.out));
	launcher.startListening().get();
}
 
Example #4
Source File: IndexOnlyProjectTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public com.google.inject.Module getServerModule() {
  ServerModule _serverModule = new ServerModule();
  final com.google.inject.Module _function = (Binder it) -> {
    AnnotatedBindingBuilder<IMultiRootWorkspaceConfigFactory> _bind = it.<IMultiRootWorkspaceConfigFactory>bind(IMultiRootWorkspaceConfigFactory.class);
    _bind.toInstance(new MultiRootWorkspaceConfigFactory() {
      @Override
      public void addProjectsForWorkspaceFolder(final WorkspaceConfig workspaceConfig, final WorkspaceFolder workspaceFolder, final Set<String> existingNames) {
        String _uri = null;
        if (workspaceFolder!=null) {
          _uri=workspaceFolder.getUri();
        }
        boolean _tripleNotEquals = (_uri != null);
        if (_tripleNotEquals) {
          URI _uri_1 = this.getUriExtensions().toUri(workspaceFolder.getUri());
          String _uniqueProjectName = this.getUniqueProjectName(workspaceFolder.getName(), existingNames);
          final FileProjectConfig project = new FileProjectConfig(_uri_1, _uniqueProjectName) {
            @Override
            public boolean isIndexOnly() {
              return true;
            }
          };
          project.addSourceFolder(".");
          workspaceConfig.addProject(project);
        }
      }
    });
  };
  return Modules2.mixin(_serverModule, _function);
}
 
Example #5
Source File: RequestManagerTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Before
public void setUp() {
  AtomicInteger _atomicInteger = new AtomicInteger();
  this.sharedState = _atomicInteger;
  ServerModule _serverModule = new ServerModule();
  Guice.createInjector(_serverModule).injectMembers(this);
}
 
Example #6
Source File: AbstractLanguageServerTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected com.google.inject.Module getServerModule() {
  ServerModule _serverModule = new ServerModule();
  final com.google.inject.Module _function = (Binder it) -> {
    it.<RequestManager>bind(RequestManager.class).to(AbstractLanguageServerTest.DirectRequestManager.class);
  };
  return Modules2.mixin(_serverModule, _function);
}
 
Example #7
Source File: N4JSIdeSetup.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public Injector createInjector() {
	return Guice.createInjector(
			Modules2.mixin(new ServerModule(), new N4JSRuntimeModule(), new N4JSIdeModule(), new TesterModule()));
}