2016-09-26 4 views
0

MultiLineCommentDocumentationProvider를 사용하여 엔티티에 대한 JavaDoc과 같은 주석을 허용합니다 (/ ** * /를 사용).Xtext : @ 주석을 사용하여 "JavaDoc"주석 만들기

그러나 일부 매개 변수에 @ (주석)을 사용하면 자바처럼 굵게 표시되지 않고 마우스를 가져 가면 줄을 끊지도 않습니다.

위의 지원을 위해 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을 사용하거나 적어도 그것에 의해 당신을 고무시킬 수 있습니다. 기독교의 조언에 따라