Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Targeting both eclipse and LSP
Targeting both eclipse and LSP [message #1763861] Mon, 22 May 2017 10:25 Go to next message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
Hi!

I have an Xtext language that I need to use both as Eclipse plugin and as a LSP server. I managed to build the two versions, but the problem is that I have code in the generator class that uses Eclipse resource APIs /IFile, IMarker) and those aren't available to the LSP server.

The right fix would be to let the generator use only Files and return markers as LSP diagnostics, while using LSP4e on the Eclipse side, but I am targeting Neon and there's a lot of plumbing to adjust in order to make that work.

So I wonder if anyone has suggestions about a simpler solution. Thanks in advance!

best regards,
Vlad
Re: Targeting both eclipse and LSP [message #1763867 is a reply to message #1763861] Mon, 22 May 2017 10:48 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Your generator should not dependent on org.eclipse.core.resources. Typically generators are agnostic of the concrete file system, that's why we have different implementations for IFileSystemAccess.

And I am not getting why a generator should use IMarker? A generator should not do any validation, that's up to the validation API. Generators should assume that the model is completely valid, everything else has to be implemented in the validator. And then LSP would use that at the right time also.
Re: Targeting both eclipse and LSP [message #1763881 is a reply to message #1763867] Mon, 22 May 2017 14:00 Go to previous message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
Thank you for the pointers, Karsten.

My excuse is that most of the code is from a while ago when I was greener, and it's not always easy to rethink it. 3rd party comments help a lot!

Anyway:

* the main reason to involve eclipse resources is that some URIs are platform:// and using ResourcesPlugin to resolve that is the simplest way (but now, it isn't anymore).

* my generator is an external process that even compiles the DSL, so this was an optimization that I have to review now.

thanks again,
Vlad


Previous Topic:Resolver/ResourceSet behavior doubts
Next Topic:Is Parser generated by XText thread safe?
Goto Forum:
  


Current Time: Thu Apr 25 00:21:24 GMT 2024

Powered by FUDForum. Page generated in 0.02901 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top