3434import com .intellij .psi .*;
3535import com .intellij .psi .search .GlobalSearchScopesCore ;
3636import com .intellij .psi .util .PsiTreeUtil ;
37- import com .intellij .util .ArrayUtil ;
3837import com .intellij .util .Function ;
3938import com .intellij .util .containers .ContainerUtil ;
4039import com .intellij .xml .util .XmlStringUtil ;
4140import org .jetbrains .annotations .NotNull ;
4241import org .jetbrains .annotations .Nullable ;
4342
44- import java .util .Collection ;
45- import java .util .Collections ;
46- import java .util .Comparator ;
47- import java .util .List ;
43+ import java .util .*;
4844
4945public class GoDocumentationProvider extends AbstractDocumentationProvider {
5046 private static final GoCommentsConverter COMMENTS_CONVERTER = new GoCommentsConverter ();
@@ -242,7 +238,7 @@ else if (type instanceof GoPointerType) {
242238 return replaceInnerTypes (type , ((GoPointerType )type ).getType ());
243239 }
244240 else if (type instanceof GoTypeList ) {
245- return replaceInnerTypes (type , ArrayUtil . toObjectArray ( GoType . class , (( GoTypeList )type ).getTypeList ())) ;
241+ return "(" + replaceInnerTypes (type , (( GoTypeList )type ).getTypeList ()) + ")" ;
246242 }
247243
248244 GoTypeReferenceExpression typeRef = GoPsiImplUtil .getTypeReference (type );
@@ -259,13 +255,18 @@ else if (type instanceof GoTypeList) {
259255
260256 @ NotNull
261257 private static String replaceInnerTypes (@ NotNull GoType type , GoType ... innerTypes ) {
258+ return replaceInnerTypes (type , Arrays .asList (innerTypes ));
259+ }
260+
261+ @ NotNull
262+ private static String replaceInnerTypes (@ NotNull GoType type , @ NotNull List <GoType > innerTypes ) {
262263 StringBuilder result = new StringBuilder ();
263264 String typeText = type .getText ();
264265 int initialOffset = type .getTextRange ().getStartOffset ();
265266 int lastStartOffset = type .getTextLength ();
266267 ContainerUtil .sort (innerTypes , ELEMENT_BY_RANGE_COMPARATOR );
267- for (int i = innerTypes .length - 1 ; i >= 0 ; i --) {
268- GoType innerType = innerTypes [ i ] ;
268+ for (int i = innerTypes .size () - 1 ; i >= 0 ; i --) {
269+ GoType innerType = innerTypes . get ( i ) ;
269270 if (innerType != null ) {
270271 TextRange range = innerType .getTextRange ().shiftRight (-initialOffset );
271272 result .insert (0 , XmlStringUtil .escapeString (typeText .substring (range .getEndOffset (), lastStartOffset )));
0 commit comments