2016-09-26 13 views
0

私はMultiLineCommentDocumentationProviderを使って、エンティティに対して(/ ** * /を使って)JavaDocのようなコメントを許可しています。Xtext:@annotationsを使って "JavaDoc"コメントを作成する

しかし、私はいくつかのパラメータに@(注釈)を使用すると、Javaのように太字にならず、マウスを動かすと行が途切れない。

上記をサポートするためにXtextのMultiLineCommentDocumentationProviderを拡張する方法がありますか?

/** some description 
@myParam param description */ 
someEntity(Param myParam) {..} 

マウスsomeEntityにホバリングするときのようになります(または、それにはいくつかの参照上):

いくつかの説明

MYPARAM:のparam説明

代わりにの(現在のように見えます):

いくつかの説明@myparamパラメータの説明

ありがとうございます。

答えて

0

、私は変わっ 'MyDSLMultiLineCommentDocumentationProvider' は、この方法:

@Override 
    public String getDocumentation(EObject o) { 
     String returnValue = findComment(o); 
     String returnValueWithAnnotations = getAnnotatedDocumentation(returnValue); 
     return getTextFromMultilineComment(returnValueWithAnnotations); 
    } 

    private String getAnnotatedDocumentation(String returnValue) { 
     boolean isFirstAnnotationFound = false; 
     StringBuilder result = new StringBuilder(""); 
    String[] splitted = returnValue.trim().split(" +"); 
    for (int i = 0; i < splitted.length; i++) 
    { 
     if (splitted[i].charAt(0) == '@') 
     { 
     if (! isFirstAnnotationFound) 
     { 
      result.append("<br><b>Parameters:</b>"); 
      isFirstAnnotationFound = true; 
     } 
     result.append("<br>"); //new line 
     result.append("<b>"); //bold 
     result.append(splitted[i].substring(1) + " "); // do not include "@" 
     result.append("</b>"); 
     } 
     else 
     { 
     result.append(splitted[i] + " "); 
     } 
    } 
    String resultString = result.toString(); 
    return resultString.substring(0, resultString.length()-1); // getting rid of the strange "/" in the end 
    } 
1

これはデフォルト機能のMultiLineCommentDocumentationProviderではありません。 XbaseHoverDocumentationProvider/XbaseHoverProviderを使用するか、少なくともそれに触発することができます。クリスチャンのアドバイスに従い

関連する問題