简体   繁体   中英

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM