Added JSDocInfo for TypeInfo too

This commit is contained in:
bigguy345 committed 2026-01-24 02:24:13 +02:00
1 parent 8799e08c17
commit 021a32b962
3 files changed
+19

No files matched your search

@@ -671,10 +671,16 @@ public class ScriptDocument {
// Extract modifiers from the matched text
String fullMatch = text.substring(m.start(), m.end());
int modifiers = parseModifiers(fullMatch);
JSDocInfo jsDoc = jsDocParser.extractJSDocBefore(text, m.start());
ScriptTypeInfo scriptType = ScriptTypeInfo.create(
typeName, kind, m.start(), bodyStart, bodyEnd, modifiers);
if (jsDoc != null) {
scriptType.setJSDocInfo(jsDoc);
}
// Store the script type first so it can be resolved by other types
scriptTypes.put(typeName, scriptType);
@@ -665,6 +665,11 @@ public class TokenHoverInfo {
errors.add(scriptType.getErrorMessage());
}
}
JSDocInfo jsDocInfo = scriptType.getJSDocInfo();
if (jsDocInfo != null) {
formatJSDocumentation(jsDocInfo, null);
}
} else if (typeInfo.isJSType()) {
JSTypeInfo jsType = typeInfo.getJSTypeInfo();
@@ -66,6 +66,9 @@ public class TypeInfo {
// Type parameters (generics)
private final List<TypeParamInfo> typeParams = new ArrayList<>();
// Documentation (script-defined types)
private JSDocInfo jsDocInfo;
private TypeInfo(String simpleName, String fullName, String packageName,
Kind kind, Class<?> javaClass, boolean resolved, TypeInfo enclosingType) {
this(simpleName, fullName, packageName, kind, javaClass, resolved, enclosingType, null);
@@ -229,9 +232,14 @@ public class TypeInfo {
}
public JSDocInfo getJSDocInfo() {
if (jsDocInfo != null) {
return jsDocInfo;
}
return jsTypeInfo != null ? jsTypeInfo.getJsDocInfo() : null;
}
public void setJSDocInfo(JSDocInfo jsDocInfo) { this.jsDocInfo = jsDocInfo; }
// Getters
public String getSimpleName() { return simpleName; }
public String getFullName() { return fullName; }