1

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.

Lidia
  • 415
  • 1
  • 4
  • 21

1 Answers1

2

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.

  • Thank you for you suggestion. I am looking for this solution over a week. And also posted on Xtext community,but didn't received many help on it.So far, I have canceled jobs XtextReconcilerJob, Xtext Validation and Refreshing outline, but the typing is still slow. I also would suggest rather to used plain text editor, but I am not the one who decides about this. – Lidia Aug 21 '14 at 12:14
  • Use a Java profiler and see where the time is spent. Hard to tell not knowing your setup and how big the files are. – Pawel Pogorzelski Aug 21 '14 at 12:18
  • Is it possible to do same for lexer? or how to build a simplified lexer. – Lidia Aug 21 '14 at 12:23
  • It makes no sense at all to disable a lexer. Not sure if anyone ever tried it. If your user explicitly wants to use an Xtext editor you should let him use it - no matter how slow it is. And yes - it's possible to write a simplified lexer. But you don't even know what takes so much time in you application. Start with profiling. – Pawel Pogorzelski Aug 21 '14 at 12:30