开发者

How to Add Legal Syntax to Language in Eclipse

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 P开发者_如何学PythonIG 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?


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜