Skip to content

Commit

Permalink
Fix type parameters coloring corner cases (#1073 #1074) (#1296)
Browse files Browse the repository at this point in the history
Missing coloring for class / interface from other compilation unit.
Applied coloring to labels outside of diamond brackets.
  • Loading branch information
RedeemerSK authored Apr 3, 2024
1 parent fef727f commit a0babe0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -904,19 +904,28 @@ protected void appendTypeParameterSignaturesLabel(String[] typeParamSigs, long f
if (i > 0) {
fBuffer.append(JavaElementLabelsCore.COMMA_STRING);
}
fBuffer.append(Signature.getTypeVariable(typeParamSigs[i]));
appendTypeParameteSignatureLabel(Signature.getTypeVariable(typeParamSigs[i]));
}
appendGT();
}
}

/**
* Appends label for single type parameter from a signature.
*
* @param typeVariableName the type variable name
*/
protected void appendTypeParameteSignatureLabel(String typeVariableName) {
fBuffer.append(typeVariableName);
}

/**
* Appends the string for rendering the '<code>&lt;</code>' character.
*/
protected void appendLT() {
fBuffer.append(getLT());
}

/**
* Returns the string for rendering the '<code>&lt;</code>' character.
*
Expand All @@ -932,7 +941,7 @@ protected String getLT() {
protected void appendGT() {
fBuffer.append(getGT());
}

/**
* Returns the string for rendering the '<code>&gt;</code>' character.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ protected void appendMethodParamName(String name) {

@Override
protected void appendTypeParameterWithBounds(ITypeParameter typeParameter, long flags) throws JavaModelException {
if (noEnhancements) {
if (noEnhancements || nextNestingLevel == 1) {
super.appendTypeParameterWithBounds(typeParameter, flags);
} else {
fBuffer.append("<span class='"); //$NON-NLS-1$
Expand Down Expand Up @@ -495,6 +495,11 @@ protected void appendTypeArgumentSignaturesLabel(IJavaElement enclosingElement,
super.appendTypeArgumentSignaturesLabel(enclosingElement, typeArgsSig, flags);
}
}

@Override
protected void appendTypeParameteSignatureLabel(String typeVariableName) {
super.appendTypeParameteSignatureLabel(wrapWithTypeClass(typeVariableName, typeVariableName));
}
}

public static final String OPEN_LINK_SCHEME= CoreJavaElementLinks.OPEN_LINK_SCHEME;
Expand Down

0 comments on commit a0babe0

Please sign in to comment.