Is it possible to use Xtext without eclipse?
Asked Answered
V

4

12

I have a DSL (implemented with ANTLR) for which I need to write a content assist/autocomplete editor. I've ported a prototype of my grammar to Xtext, and I'm quite happy with the quality of the editor it generates.

Unfortunately, I cannot use Eclipse as my editor. Instead, I'd like use the Xtext grammar to generate some artifacts that I could reuse outside of Eclipse. From what I've seen, the minimum set of artifacts I need are:

  • the EMF models,
  • the parsers,
  • the *ProposalProviders, and
  • the required libraries.

Has anyone tried to use Xtext outside of Eclipse? How many external libraries does it depend on?

Thanks!

Vickivickie answered 20/10, 2011 at 18:49 Comment(0)
G
10

for the backend part (parser / serializer / formatter / metamodel etc) this is not problem and it will require about 30 libaries / 17MB. the ui part requires eclipse.

you can use the export -> runnable jar file wizard to get all dependent libs you need

Genital answered 21/10, 2011 at 19:50 Comment(4)
What about web editor? That doesn't seem to require Eclipse, but it's unclear how it should work with, say, autocompletion. It is there by default, but customizing it via proposal provider doesn't seem to be an option, since the one Xtext generates in ui subproject can't seem to be reused outside Eclipse as it relies on interfaces in jface package.Heraclitean
There is a new API for a eclipse independent proposal provider going into the mydsl.ide project that is created by the wizard since xtext 2.9Genital
Thanks for the hint, but is this new API documented somewhere?Heraclitean
no there is no docs. have a look at the example projects e.g. github.com/eclipse/xtext-web/blob/…Genital
I
8

Essentially the same answer as the one given by Christian, this is just a pointer to a more detailed description of How to Deploy Xtext to a Headless Plain-Java Environment. If you are interested in using the artifacts generated from the grammar, you can find a snippet in the XText FAQ

Itagaki answered 2/11, 2011 at 16:6 Comment(0)
S
1

You can use command line mode of xtext application. For this purposes : you schould in workflow description file GenerationYourDSLName.mwe2 the following lines

// generator API
fragment = generator.GeneratorFragment {
  generateJavaMain = true
}

then generate xtext artifacts

Sunup answered 17/9, 2015 at 15:33 Comment(0)
S
1

With Xtext 2.9, it is possible to build your language infrastructure independent of Eclipse (and possibly targeting IntelliJ IDEA or the web), using plain old Maven/Gradle. Just uncheck the Eclipse plugin facet when creating an Xtext project and set the Preferred Build System to Maven or Gradle.

Ss answered 11/11, 2015 at 8:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.