Ondrej Havlicek
Ondrej Havlicek

Reputation: 170

Custom language Xtext LanguageServer

I am tying to make a simple example of language server running with IntelliJ Idea plugin.

I started with a simple Xtext project from Eclipse. I did nothing special. Just created a new Xtext project and built it with gradle. For some reason my new language is not registered as a language and the server complains about that.

When I start the server and send the request, I get this message back:

Aug 29, 2020 7:48:50 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError
SEVERE: Internal error: java.lang.reflect.InvocationTargetException
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67)
    at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
    at org.eclipse.lsp4j.jsonrpc.validation.ReflectiveMessageValidator.consume(ReflectiveMessageValidator.java:68)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
    at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
    ... 12 more
Caused by: java.lang.IllegalStateException: No Xtext languages have been registered. Please make sure you have added the languages's setup class in '/META-INF/services/org.eclipse.xtext.ISetup'
    at org.eclipse.xtext.ide.server.LanguageServerImpl.initialize(LanguageServerImpl.java:211)
    ... 17 more

I tried to search for this file /META-INF/services/org.eclipse.xtext.ISetup but it doesnt exist anywhere in the project or built artifacts.

Does someone have an idea how to register the language?

Upvotes: 0

Views: 256

Answers (1)

Ondrej Havlicek
Ondrej Havlicek

Reputation: 170

It was actually a problem of the Eclipse - it didn't see those files. I was able to locate them in total commander. Then after reinstall and refresh, all was fine.

Upvotes: 0

Related Questions