How can I get syntax highlighting for my format in an Eclipse text editor?

I need to highlight the syntax for text with a specific structure in an Eclipse text editor. The scheme is simple; basically, each line has six words separated by spaces, and the lines starting with C # are comments. The most important thing is to highlight the comments, but it would be useful to individually color the six elements in lines without comments.

If this is too hard to get, maybe I could use an existing plugin designed for something with similar syntax. Any suggestions?

0
eclipse text-editor syntax-highlighting eclipse-plugin file-association
source share
2 answers

If you want to write your own editor, you can try XText . With XText, you can write editors for your own DSL (Domain Specific Language), which I suspect you have. Editors also support automatic completion and other nice features. I have not tried XText yet, but I heard that it is pretty easy to learn.

If the comment highlighting is sufficient, you can also try to assign file endings, for example, the configuration for the property files, since the comments in the property files are also #. You can edit the configuration in Window -> Preferences -> Editors -> File Associations, and then select the property file editor for your file type.

+1
source share

This is exactly one of the goals of LiClipse ( http://brainwy.imtqy.com/liclipse/ ): it's easy to make an editor with syntax highlighting, basic code completion, outline, etc. for eclipse.

No java skills are required to add a new language (basically creating a new .liclipse - which is a YAML file in the right place and creating some basic rules to say how to separate your language - that is: usually just separating the code from the comments from the lines - and indicating the keywords that you have in the section will already give you the correct syntax highlighting).

If you download it, there are several examples on the plugins \ com.brainwy.liclipse.editor \ languages ​​and there is basic documentation on http://brainwy.imtqy.com/liclipse/supported_languages.html and http: // brainwy. imtqy.com/liclipse/scope_definition.html on how to do this.

+1
source share

All Articles