When I build my language server, I got this problem:

Hi, When I build My language server, got this problem:

ERROR:org.eclipse.sprotty.LayoutOptions cannot be resolved to a type.
ERROR:org.eclipse.sprotty.SEdge cannot be resolved to a type.
ERROR:org.eclipse.sprotty.SGraph cannot be resolved to a type.
……
ERROR:The method or field StatesCodeActionService is undefined

  • What went wrong:
    Execution failed for task ‘:aaa0513.mydsl.ide:generateXtext’.

Xtext validation failed, see build log for details.

Anyone know what happened? Thank you!

[original thread by yuyue1997]

Looks like you started from the https://github.com/TypeFox/theia-xtext-sprotty-example. Which stage did you start from?
Sprotty is only needed if you want your server to also provide diagrams.

The error message says that your build lacks the sprotty lib. So you are likely missing a dependency, e.g. https://github.com/TypeFox/theia-xtext-sprotty-example/blob/f12ed3348ebe056df3d78c6a0cf8c465aa3d85bf/language-server/io.typefox.examples.theia.states.ide/build.gradle#L6

[yuyue1997]

Oh, thank you for your reply! yes, my server need to provide diagrams, now we add these dependencies and yarn success.

Question:
but on the theia browser , we click “open in diagram” , we can’t see the diagram and have this output :
[Error - 下午5:04:39] No diagram service for type ‘states-diagram’
[Error - 下午5:04:50] Cannot choose default from multiple diagram types:
[Error - 下午5:04:50] No diagram service for type ‘null’
on terminal
root WARN Widget was activated, but did not accept focus after 2000ms: outputView
root WARN Widget was activated, but did not accept focus after 2000ms: outputView

What should we do now ? :3

The diagram service is provided by the DiagramServerFactory of your language (on the language server side). Make sure your language provides the appropiate IDiagramServerFactory via the diagram module of your language, and use the diagram module in the launcher config as well.