Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to call generators in an LSP command(How can one call an Xtext generator in an 'Xtext LSP with VS Code extension' context manually?)
How to call generators in an LSP command [message #1827028] Wed, 06 May 2020 09:12 Go to next message
Stefan Kapferer is currently offline Stefan KapfererFriend
Messages: 19
Registered: March 2020
Junior Member
Hi there

I have a question regarding the Xtext LSP.

We already have an Eclipse plugin project for our Xtext DSL and want to offer support for VS Code now (by using the LSP of course). I started with my VS code extension by using the example project here: https://github.com/itemis/xtext-languageserver-example

My question: In our Xtext project, the generators are not called automatically (by intention). We disabled the automatic generation and offer context menu entries in Eclipse to call them manually (inspired by this solution: https://www.dietrich-it.de/xtext/2011/10/15/xtext-calling-the-generator-from-a-context-menu.html). Now, how can I implement the same thing in my VSCode/LSP solution?

My idea is to create commands, and then call the generators (that implement the IGenerator2 interface) from the CommandService (implements IExecutableCommandService). Is this the right way to do it? And if yes, has anyone an example how I can call the generators in this context? (I'm especially not sure how to get the IFileSystemAccess2 in this context)

Thanks and best regards,
Stefan
Re: How to call generators in an LSP command [message #1827038 is a reply to message #1827028] Wed, 06 May 2020 11:11 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
you can create a java.io.FileSystemAccess or a InMemoryFileSystemAccess depending on your needs



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to call generators in an LSP command [message #1827039 is a reply to message #1827038] Wed, 06 May 2020 11:19 Go to previous message
Stefan Kapferer is currently offline Stefan KapfererFriend
Messages: 19
Registered: March 2020
Junior Member
Thanks Christian, and sorry for the stupid question :)

Got it working... Basically the same possibilities as when using Xtext standalone (outside Eclipse).
Previous Topic:Serialization of unordered, optional attributes
Next Topic:[SOLVED] Porting project from xtext plugin to xtext lsp server
Goto Forum:
  


Current Time: Fri Apr 19 22:16:47 GMT 2024

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

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

Back to the top