xtext: How to disable textual input validation for generated xtext plugins (dsl)

707 views Asked by At

In Xtext there are few different kinds of validations which xtext takes care automatically. Is there any possibility to disable them?

  • Lexer/Parser: Syntactical Validation
  • Linker: Crosslink Validation

I am trying to disable the parser/lexer for being able to edit very huge files into a dsl editor. As far as I can see it is not possible to do from mwe2 workflow, as following fragment is the entry point for being able to open the editor.

fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject {}

I have mentioned that InternalMysDslLexer class is instantiated many times while I am typing something. Should I override this class? what would be the correct approach?

Thank you.

1

There are 1 answers

4
Pawel Pogorzelski On

To disable linking override ILinker in your Runtime module:

public Class<? extends ILinker> bindILinker() {
    return MyLinker.class;
}

And then override doLinkModel() to do noting (only for huge files I guess):

public class MyLinker extends LazyLinker {
    protected void doLinkModel(final EObject model, IDiagnosticConsumer consumer) {}
}

Not sure what you mean by saying you want to disable syntax validation. This would disable all the Xtext features. Isn't it better to simply edit huge files using a regular text editor instead of Xtext one?

There's also a lot of resources on Xtext performance on SO, Eclipse Xtext community forum, and various blogs.