Reputation: 220
I want to provide a bit of very simple editor support for a new language which is in development in elcipse. Just basic key-wordhighlight, brace matching maybe block folding.
In most editors (vim, emacs or notpad++) I can acomplish that reltively simple by more or less giving a list of keyword with some simple directives. However eveything I looked at in eclipse needs real parsing an antlr-grammar or directly translating from the compilers.
This is certainly powerful, but just too much work for the language I indent to support,because as said the languag is in develompment changes (and is not that much used). So the work for a full IDE-Editor in eclipse does not realy pay off.
So my question is: What is the simplest way to add syntaxcoloring for keywords to an eclipse editor?
Thanks
Upvotes: 2
Views: 181
Reputation: 108899
If you're willing to write your own plug-in, Eclipse has a sample plug-in project called Plug-in with an editor that contains simple, hard-coded syntax highlighting. You could adapt this to read a list of keywords from a file. Exported plugin jars can be dropped into your IDE dropin directory.
To create the sample:
You will need to edit XMLPartitionScanner.java
to provide your own syntax rules.
public XMLPartitionScanner() {
IToken xmlComment = new Token(XML_COMMENT);
IToken tag = new Token(XML_TAG);
IPredicateRule[] rules = new IPredicateRule[2];
rules[0] = new MultiLineRule("<!--", "-->", xmlComment);
rules[1] = new TagRule(tag);
setPredicateRules(rules);
}
See IPredicateRule
implementations.
Upvotes: 2
Reputation: 3454
You can try xtext - eclipse plugin for creating DSL languages. But it would not be as simple as a list of keywords.
Upvotes: 0