Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [xtend2] Use comments as doc
[xtend2] Use comments as doc [message #732292] Tue, 04 October 2011 12:23 Go to next message
Hauke Fuhrmann is currently offline Hauke FuhrmannFriend
Messages: 333
Registered: July 2009
Senior Member
Hi there,

is there a way that comments in xtend2 can be used as Eclipse integrated
comments such as when hovering or autocompleting functions? Just like
Javadoc comments are used by the JDT. Is there a way to transfer
comments in an xtend class into the generated Java class such that the
JDT can pick them up?

Cheers,
Hauke
Re: [xtend2] Use comments as doc [message #732297 is a reply to message #732292] Tue, 04 October 2011 12:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
Hi,

i guess you have to come up with a patched
Xtend2Compiler that uses MultiLineCommentDocumentationProvider
to get the comments. unfortunately xtend2
has no nice hooks to change code.

~Christian

Am 04.10.2011 14:23, schrieb Hauke Fuhrmann:
> Hi there,
>
> is there a way that comments in xtend2 can be used as Eclipse integrated
> comments such as when hovering or autocompleting functions? Just like
> Javadoc comments are used by the JDT. Is there a way to transfer
> comments in an xtend class into the generated Java class such that the
> JDT can pick them up?
>
> Cheers,
> Hauke


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [xtend2] Use comments as doc [message #732298 is a reply to message #732297] Tue, 04 October 2011 13:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
Here a very basic version:

import
org.eclipse.xtext.documentation.impl.MultiLineCommentDocumentationProvider;
import org.eclipse.xtext.xbase.compiler.IAppendable;
import org.eclipse.xtext.xtend2.compiler.Xtend2Compiler;
import org.eclipse.xtext.xtend2.xtend2.XtendClass;

import com.google.inject.Inject;

public class ExtendedXtend2Compiler extends Xtend2Compiler {

@Inject MultiLineCommentDocumentationProvider mlcdp;

@Override
protected void compile(XtendClass obj, IAppendable appendable) {
String doc = mlcdp.getDocumentation(obj);
if (doc != null) {
appendable.append("/**\n");
appendable.append(doc);
appendable.append("\n*/");
}

super.compile(obj, appendable);
}

}

Am 04.10.2011 14:47, schrieb Christian Dietrich:
> Hi,
>
> i guess you have to come up with a patched
> Xtend2Compiler that uses MultiLineCommentDocumentationProvider
> to get the comments. unfortunately xtend2
> has no nice hooks to change code.
>
> ~Christian
>
> Am 04.10.2011 14:23, schrieb Hauke Fuhrmann:
>> Hi there,
>>
>> is there a way that comments in xtend2 can be used as Eclipse integrated
>> comments such as when hovering or autocompleting functions? Just like
>> Javadoc comments are used by the JDT. Is there a way to transfer
>> comments in an xtend class into the generated Java class such that the
>> JDT can pick them up?
>>
>> Cheers,
>> Hauke
>


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [xtend2] Use comments as doc [message #733483 is a reply to message #732292] Tue, 04 October 2011 20:56 Go to previous message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
This will likely be added in Xtext 2.1 (Beginning of November).

Am 04.10.11 14:23, schrieb Hauke Fuhrmann:
> Hi there,
>
> is there a way that comments in xtend2 can be used as Eclipse integrated
> comments such as when hovering or autocompleting functions? Just like
> Javadoc comments are used by the JDT. Is there a way to transfer
> comments in an xtend class into the generated Java class such that the
> JDT can pick them up?
>
> Cheers,
> Hauke


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


---
Get professional support from the Xtext committers at www.typefox.io
Previous Topic:Xtext hangs on multiple parentheses
Next Topic:Xtext in production
Goto Forum:
  


Current Time: Tue Sep 24 23:22:57 GMT 2024

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

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

Back to the top