drawn KEYWORD token color for primitive types in hover info

This commit is contained in:
bigguy345 committed 2026-01-03 02:00:23 +02:00
1 parent 4146b156a2
commit b613ec86fe
4 files changed
+7 -29

No files matched your search

@@ -1130,10 +1130,8 @@ public class TokenHoverInfo {
* Works for both Java-backed TypeInfo and ScriptTypeInfo.
*/
private int getColorForTypeInfo(TypeInfo typeInfo) {
if (typeInfo == null) return TokenType.IMPORTED_CLASS.getHexColor();
// Use the TypeInfo's own token type, which handles ScriptTypeInfo correctly
return typeInfo.getTokenType().getHexColor();
return TokenType.getColor(typeInfo);
}
/**
@@ -80,18 +80,7 @@ public enum TokenType {
public static TokenType getByType(TypeInfo typeInfo) {
if (typeInfo == null || !typeInfo.isResolved())
return TokenType.UNDEFINED_VAR;
switch (typeInfo.getKind()) {
case INTERFACE:
return TokenType.INTERFACE_DECL;
case ENUM:
return TokenType.ENUM_DECL;
case CLASS:
return TokenType.CLASS_DECL;
default:
break;
}
// Use the TypeInfo's own token type, which handles ScriptTypeInfo correctly
return typeInfo.getTokenType();
}
@@ -653,18 +653,6 @@ public class ScriptTypeInfo extends TypeInfo {
return null;
}
@Override
public TokenType getTokenType() {
switch (getKind()) {
case INTERFACE:
return TokenType.INTERFACE_DECL;
case ENUM:
return TokenType.ENUM_DECL;
case CLASS:
default:
return TokenType.CLASS_DECL;
}
}
// Script types are always considered resolved since they're defined in the script
@Override
@@ -134,14 +134,17 @@ public class TypeInfo {
public boolean isInnerClass() { return enclosingType != null; }
public boolean isInterface() {return kind == Kind.INTERFACE;}
public boolean isEnum() {return kind == Kind.ENUM;}
public boolean isPrimitive() {return javaClass != null && javaClass.isPrimitive();}
/**
* Get the appropriate TokenType for highlighting this type.
*/
public TokenType getTokenType() {
if (!resolved) {
if (!resolved)
return TokenType.UNDEFINED_VAR;
}
if(isPrimitive())
return TokenType.KEYWORD;
switch (kind) {
case INTERFACE:
return TokenType.INTERFACE_DECL;