

Is there a way to add a simple highlighting code to eclipse by simply giving a l...
source link: https://www.codesd.com/item/is-there-a-way-to-add-a-simple-highlighting-code-to-eclipse-by-simply-giving-a-list-of-different-keywords-bulk-boot-etc.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Is there a way to add a simple highlighting code to eclipse by simply giving a list of different keywords, bulk boot, etc.?
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
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:
- File > New > Project...
- Plug-in Development > Plug-in Project > Next
- Enter a project name
- In the Templates page of the wizard, select "Plug-in with an editor"
- Choose a new file extension for your language prior to selecting finish
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.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK