0

I've implemented a Language Server for a Java-like "toy" DSL based on Xtext together with a VS code extension and everything worked like a charm.

Trying to improve my language server a bit, I've added "imports" support and have leveraged the scoping system to resolve cross-file references and global scoping. Once again, it worked like a charm. Nonetheless, for the language server to be able to resolve imported classifiers, both files should live within the same workspace.

In order to enable global scoping outside the workspace boundaries, I am thinking of adding classpath definition file in YML, containing path to the other files that are referenced to by and that live outside the workspace boundaries. The idea would be to lazily resolve them when referenced to by other files. Let's say that the classpath specification will be in the same project as the referencing files.

Is this something we can do in Xtext? If so, can you please point me to some code snippets?

Thank you in advance,

Amine Ben
  • 65
  • 6
  • 1
    any reason to do this lazy and not the teach the project manager this behaviour org.eclipse.xtext.ide.server.ProjectManager.doInitialBuild(CancelIndicator) – Christian Dietrich Nov 13 '19 at 18:46
  • Thank you for your quick response. The only reason why I would like to it lazily is simply to resolve dependencies only at import request! Does this make sense? Meanwhile, I'll try to investigate the direction you gave! Many thanks! – Amine Ben Nov 14 '19 at 10:20
  • Hi Christian, I've extended the class ProjectManager and overrode and injected the dependency in the ServerIdeModule. Due to the changes I've introduced, the server crashes onDidChangeNotification. I suspect that it is an error that I introduced in my new change. Is there a way to systematically send crash reports to the clients based on the LSP protocol? Many thanks, – Amine Ben Nov 18 '19 at 09:03
  • yes and no. you might abuse window/showMessage – Christian Dietrich Nov 18 '19 at 11:04

0 Answers0