No diagram shows on theia

when I click"open in diagram" nothing show on theia.
in the terminal, it shows

root ERROR MyDsl: ���� 08, 2020 5:00:35 ���� org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleNotification
����: Notification threw an exception: {
“jsonrpc”: “2.0”,
“method”: “diagram/accept”,
“params”: {
“clientId”: “states-diagram_0”,
“action”: {
“kind”: “computedBounds”,
“revision”: 2,
“bounds”: [
{
“elementId”: “y.label”
},
{
“elementId”: “y.newRelationship”
},
{
“elementId”: “y”
},
{
“elementId”: “x.label”
},
{
“elementId”: “x.newRelationship”
},
{
“elementId”: “x”
},
{
“elementId”: “y:a:x.label”
}
],
“alignments”: [
{
“elementId”: “y.label”,
“newAlignment”: {
“x”: 0.921875,
“y”: 11.828125
}
},
{
“elementId”: “x.label”,
“newAlignment”: {
“x”: 0.921875,
“y”: 11.828125
}
},
{
“elementId”: “y:a:x.label”,
“newAlignment”: {
“x”: 0.0,
“y”: 11.828125
}
}
]
}
}
}
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.notify(GenericEndpoint.java:152)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:220)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:187)
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.j

[original thread by yuyue1997]

Looks like LSP is not aware of the diagram/accept method provided by Sprotty. How do you launch the languauge server? Are you using a DiagramServerLauncher? What is configured in the method getLanguageServerModule() of its DiagramLanguageServerSetup?

[Qizewen]

Yes,we are using a DiagramServerLauncher.

class StatesServerLauncher extends DiagramServerLauncher {

override createSetup() {
    new StatesLanguageServerSetup
}

def static void main(String[] args) {
    new StatesServerLauncher().run(args)
}

}

and in StatesLanguageServerSetup

class StatesLanguageServerSetup extends DiagramLanguageServerSetup {

override setupLanguages() {
    ElkLayoutEngine.initialize(new LayeredMetaDataProvider)
    Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put('elkg', new ElkGraphResourceFactory)
}

override configureGson(GsonBuilder gsonBuilder) {
    gsonBuilder
        .registerTypeAdapterFactory(new EditActionTypeAdapterFactory)
        .registerTypeAdapterFactory(new EnumTypeAdapter.Factory)
}

override getLanguageServerModule() {
    Modules2.mixin(
        new ServerModule,
        new SyncDiagramServerModule
    ) 
}

}

in StatesSocketServer

class StatesSocketServer extends DiagramServerSocketLauncher {

override createSetup() {
    new StatesLanguageServerSetup
}

def static void main(String... args) {
    new StatesSocketServer().run(args)
}

}

Are there any problems with them?