menu
Channels
Team

On theia, we have some problems about sprotty.

June 10, 2020 at 6:54am

On theia, we have some problems about sprotty.

June 10, 2020 at 6:54am
Hi, When I click "open in diagram" , in output it shows
[Warn - 下午2:45:57] Duplicate ID 'a.label' [Warn - 下午2:45:57] Duplicate ID 'a.label' [Warn - 下午2:45:57] Duplicate ID 'a.label1' [Warn - 下午2:45:57] Duplicate ID 'a.label' [Warn - 下午2:45:57] Duplicate ID 'a.label1' [Warn - 下午2:45:57] Duplicate ID 'a.label2' [Warn - 下午2:45:57] Duplicate ID 'a.label' [Warn - 下午2:45:57] Duplicate ID 'a.label1' [Warn - 下午2:45:57] Duplicate ID 'a.label2' [Warn - 下午2:45:57] Duplicate ID 'a.label3' [Warn - 下午2:46:55] Duplicate ID 'a.label' [Warn - 下午2:46:55] Duplicate ID 'a.label1' [Warn - 下午2:46:55] Duplicate ID 'a.label2' [Warn - 下午2:46:55] Duplicate ID 'a.label3' [Warn - 下午2:46:55] Duplicate ID 'a.label4' [Error - 下午2:46:55] Error during request: : java.lang.IllegalArgumentException: null is not an XtextResource at org.eclipse.sprotty.xtext.tracing.PositionConverter.toPosition(PositionConverter.java:63) at org.eclipse.sprotty.xtext.tracing.PositionConverter.toRange(PositionConverter.java:71) at org.eclipse.sprotty.xtext.tracing.PositionConverter.toRange(PositionConverter.java:67) at org.eclipse.sprotty.xtext.tracing.XtextTraceProvider.doTrace(XtextTraceProvider.java:85) at org.eclipse.sprotty.xtext.tracing.XtextTraceProvider.trace(XtextTraceProvider.java:77) at io.typefox.examples.theia.states.ide.diagram.StatesDiagramGenerator.lambda$toSNode$4(StatesDiagramGenerator.java:72) at org.eclipse.sprotty.SNode.<init>(SNode.java:47) at io.typefox.examples.theia.states.ide.diagram.StatesDiagramGenerator.toSNode(StatesDiagramGenerator.java:84) at io.typefox.examples.theia.states.ide.diagram.StatesDiagramGenerator.lambda$null$0(StatesDiagramGenerator.java:55) at org.eclipse.xtext.xbase.lib.internal.FunctionDelegate.apply(FunctionDelegate.java:43) at com.google.common.collect.Lists$TransformingRandomAccessList$1.transform(Lists.java:612) at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:47) at org.eclipse.sprotty.SModelIndex.addToIndex(SModelIndex.java:72) at org.eclipse.sprotty.SModelIndex.<init>(SModelIndex.java:52) at org.eclipse.sprotty.LayoutUtil.copyLayoutData(LayoutUtil.java:54) at org.eclipse.sprotty.DefaultDiagramServer.updateModel(DefaultDiagramServer.java:189) at org.eclipse.sprotty.xtext.ls.DiagramUpdater.lambda$null$3(DiagramUpdater.java:129) at java.util.ArrayList.forEach(ArrayList.java:1257) at org.eclipse.sprotty.xtext.ls.DiagramUpdater.lambda$doUpdateDiagrams$4(DiagramUpdater.java:132) at org.eclipse.xtext.ide.server.LanguageServerImpl$1.lambda$null$0(LanguageServerImpl.java:1117) at org.eclipse.xtext.ide.server.WorkspaceManager.doRead(WorkspaceManager.java:479) at org.eclipse.xtext.ide.server.LanguageServerImpl$1.lambda$doRead$1(LanguageServerImpl.java:1116) at org.eclipse.xtext.ide.server.concurrent.ReadRequest.lambda$doRun$0(ReadRequest.java:66) 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:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) anyone familiar with this error?

June 10, 2020 at 7:03pm
It's your responsibility to generate unique IDs in the your IDiagramGenerator. See the examples how the ID cache can be used for that.
  • reply
  • like
The error should be debuggable setting a breakpoint#
  • reply
  • like

June 11, 2020 at 2:14am
It's your responsibility to generate unique IDs in the your IDiagramGenerator. See the examples how the ID cache can be used for that.
Thank you very much for putting your time!
workdone: About IDiagramGenerator we set just one node for test. we know that this class is use to convert a concept into a SNode in sprotty. So we've set the id property of this concept to be unique.
def SNode toSNode(Actor actor, extension Context context) { val theId = idCache.uniqueId(actor, actor.name) (new SNode [ id = theId children = #[ (new SLabel [ id = idCache.uniqueId(theId + '.label') text = actor.name ]).trace(actor)
Below:
But the "Duplicate ID" error still exist.
Also in the terminal the error seems that LSP is not aware of the diagram/accept method provided by Sprotty. We have refer to the example "theia-xtext-sprotty-example-master " and use the same method in "**.ide.launch". Is there any other method might have influenced "diagram/accept" method ?
I apologize if it's the repetitive question, but I am trying to understand how things are working.
Thanks!
  • reply
  • like
The diagram/accept method is provided by the DiagramLanguageServer. It has to replace the standard LanguageServerImpl. Note that this is part of the general configuration, not the language specific one, so it must be configured in the ServerModule. Make sure you use a DiagramServerModule or SyncDiagramServerModule instead, e.g. in unit tests that inherit from AbstractLanguageServerTest, you have to override getServerModule().
  • reply
  • like