Title: How to Add Legal Syntax to Language in Eclipse
Tags: eclipse;xtext
Question: I've seen similar questions to this on StackOverflow regarding adding highlighting to a language, but what I'm concerned with is getting Eclipse (I'm guessing xtext?) to stop marking certain syntax as incorrect for a language.
Specifically, I have a wrapper from which I call PIG files that looks for certain syntax in the PIG file that would normally be illegal in PIG and substitutes a template for it. I'd like Eclipse to stop marking this syntax as incorrect and giving me ugly red x's in my folder structure because of it. Is there a simple way to do this? Or failing that, to at least disable marking of incorrect for that language in general?

Here is the accepted answer: Generally, error markers are created by two entities: editors and builders (compilers). If your existing editor understands the PIG format, it might display parse errors in the opened editor as you are typing. The only way to disable this feature is to re-open the file using a different editor (right-click the file, select Open with... and find an editor - e.g. plain text editor). To support syntax highlighting/error display in other parts, but not in special parts, you have to provide your own editor - that can be written using Xtext.
If the error markers are provided using a builder, then they are only refreshed on save - when it tries to understand the format, and provide an output. In this case, you only have to make sure that the templates are substituted before the file is executed (you can reorder the builder in the project preferences if needed). If you have no such builder, you could disable the PIG builder, that would prevent displaying the erroneous markers (however, it also disables displaying the correct ones as well).


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2011:00:08/29/11', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<eclipse><xtext>', 'Title': 'How to Add Legal Syntax to Language in Eclipse', 'ViewCount': 203, 'id': 7233341, 'user_AboutMe': "<p>I'm a Data Engineer/Scientist interested in NLP, Big Data, Machine Learning, Linguistics and Human Languages. I'm also the founder of Constructor.io.</p>\n", 'user_AccountId': 167882.0, 'user_DisplayName': 'Eli', 'user_Reputation': 35035.0, 'user_Views': 1672.0, 'user_id': 392975.0}}