Tuesday, June 7, 2011

New Features In The Xtext Grammar Editor

Besides the huge new features like the Xbase library, the new Xtend and the cross language refactoring capabilities, we made sure that we still find some time to implement small refinements and improvements in Xtext's core. Some of them may be not too obvious but I'm pretty sure they will actually have some impact on the overall user experience when building new languages with the framework. This blog post is about two nice additions in the grammar editor that are available in Xtext 2.0 with Eclipse Indigo.

Improved content assist

You'll often want to create a concrete syntax for an existing EPackage which was somewhat cumbersome in the past since it involved copy and paste of the namespace uri. The good news is:
Adding imported packages was greatly simplified. It's now far easier to find the actual EPackage that you want to use in your grammar because content assist matches for the more selective last segments of the namespace uri, too:

Speaking about imported packages: If you want to override a rule from another grammar, you can now use content assist to create a stub for that. The editor will take care of necessary import clauses:

Quick Fixes

If your workflow is similar to mine, you'll usually develop a grammar top-down. This implies that your grammar often contains a bunch of unresolved rule calls since the invocation of a parser rule appears before the rule itself is written. A new quick fix allows to create stubs for unknown rules as soon as you refer to a rule which does not yet exist:

I hope you like these small improvements as much as I do!


Simon Zambrovski said...

Great work, Seb. Thanks...

Matt Brown said...
This comment has been removed by the author.
Matt Brown said...

I’m impressed with the special and informative contents that you just offer in such short timing.Grammarly

aliya seen said...

Our sentence grammar check is there to enhance your grammar and English. It is an important part of our life. Very interesting blog.