Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Coloring Comments
Coloring Comments [message #901541] Mon, 13 August 2012 09:50 Go to next message
Andreas Graf is currently offline Andreas GrafFriend
Messages: 211
Registered: July 2009
Senior Member
Hi,

I would like to color certain fixed words in comments in my grammar. So when the user
writes something like

// dljfdljfdfdkj
// author: ldjflkjdfldkfj

I would like to somehow highlight author or the entire line.

Any Ideas on that?

Andreas
Re: Coloring Comments [message #901629 is a reply to message #901541] Mon, 13 August 2012 17:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14664
Registered: July 2009
Senior Member
Hi,

sounds like a case for semantic highlighting.
we use that to color //TODO xxxx like in java

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Coloring Comments [message #901652 is a reply to message #901541] Mon, 13 August 2012 21:46 Go to previous messageGo to next message
Dobes Vandermeer is currently offline Dobes VandermeerFriend
Messages: 26
Registered: July 2009
Junior Member
If you look at TerminalsTokenTypeToPartitionMapper you can see the partition names that are being used for comments by default.

There is probably a way to hook in your own colors within the partition using the standard eclipse methods of doing so, which I am somewhat vague on.

Re: Coloring Comments [message #901665 is a reply to message #901541] Tue, 14 August 2012 01:21 Go to previous message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
Take a look at
org.cloudsmith.geppetto.pp.dsl.ui.coloring.PPSemanticHighlightingCalculator
in cloudsmith/geppetto @ github

There I use different ways to style; terminal tokens, textual (bad
whitespace), as well as semantic. The above class has the scaffolding
for all of that...

It also calls out to a special documentation/comments parser that parses
RDoc style comments.

Hope that helps.

Regards
- henrik

On 2012-13-08 11:50, Andreas Graf wrote:
> Hi,
>
> I would like to color certain fixed words in comments in my grammar. So
> when the user
> writes something like
>
> // dljfdljfdfdkj
> // author: ldjflkjdfldkfj
>
> I would like to somehow highlight author or the entire line.
>
> Any Ideas on that?
>
> Andreas
>
Previous Topic:Method createSequence is exceeding 65535
Next Topic:2 DSLs, importURI + importedNamespace in one grammar?
Goto Forum:
  


Current Time: Tue Apr 16 07:35:09 GMT 2024

Powered by FUDForum. Page generated in 0.13902 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top