0

I wrapped an Ace Editor in a React Front-End Application and served a separat Java-Backend using the LanguageServerImpl class to have my own grammar using Xtext.

I want to use xtexts validation and autocomplete methods passing data between the Ace Editor and the Xtext Languageserver. The way it works is in sending JSON-RPC between the Editor and the Langserver. But there is no documentation how to call the valdiation or autocompletion from Editor to Server an back to Editor with the response. How does the JSON-RPC looks like to achieve this behaviour?

This is the Code how I init the Lang- Server. Currently the Input is a simple System.in Stream.

server = injector.getInstance(LanguageServerImpl.class);
org.eclipse.lsp4j.jsonrpc.Launcher<LanguageClient> launcher = LSPLauncher.createServerLauncher(server, in, out);
LanguageClient client = launcher.getRemoteProxy();
server.connect(client);
launcher.startListening();

The second question I have is: Why do I need the LanguageClient? The Editor is the Client which is hosted by a different Server...

  • you need something that talks from the editor part to the language server. this thing is language client. i am not sure if there is one for ace. is there? – Christian Dietrich Mar 16 '20 at 11:44
  • if you e.g. use monaco you can make use of https://github.com/TypeFox/monaco-languageclient (use Xtext 2.20 as newer LSP4J versions wont work) – Christian Dietrich Mar 16 '20 at 11:57

0 Answers0