diff --git a/src/main/java/noppes/npcs/client/gui/util/script/interpreter/hover/TokenHoverInfo.java b/src/main/java/noppes/npcs/client/gui/util/script/interpreter/hover/TokenHoverInfo.java index c172ec9db..75150e1e1 100644 --- a/src/main/java/noppes/npcs/client/gui/util/script/interpreter/hover/TokenHoverInfo.java +++ b/src/main/java/noppes/npcs/client/gui/util/script/interpreter/hover/TokenHoverInfo.java @@ -243,6 +243,9 @@ public class TokenHoverInfo { if (callInfo.hasStaticAccessError()) { errors.add(callInfo.getErrorMessage()); } + if (callInfo.getErrorType() == MethodCallInfo.ErrorType.UNRESOLVED_METHOD) { + errors.add(callInfo.getErrorMessage()); + } } // Show field access errors diff --git a/src/main/java/noppes/npcs/client/gui/util/script/interpreter/method/MethodCallInfo.java b/src/main/java/noppes/npcs/client/gui/util/script/interpreter/method/MethodCallInfo.java index bd73b497f..a0005efa0 100644 --- a/src/main/java/noppes/npcs/client/gui/util/script/interpreter/method/MethodCallInfo.java +++ b/src/main/java/noppes/npcs/client/gui/util/script/interpreter/method/MethodCallInfo.java @@ -331,13 +331,16 @@ public class MethodCallInfo { public void validate() { if (isConstructor) { if (resolvedMethod == null) { - // For constructors, check if the type has any constructors at all - if (receiverType != null && receiverType.hasConstructors()) { - setError(ErrorType.WRONG_ARG_COUNT, - "No constructor in '" + receiverType.getSimpleName() + "' matches " + arguments.size() + " argument(s)"); - } else { - setError(ErrorType.UNRESOLVED_METHOD, - "Cannot resolve constructor for '" + methodName + "'"); + // Don't report missing JS constructors as unresolved method error, since they may be created dynamically at runtime + boolean isJSType = receiverType != null && receiverType.isJSType(); + if (!isJSType) { + if (receiverType != null && receiverType.hasConstructors()) { + setError(ErrorType.WRONG_ARG_COUNT, + "No constructor in '" + receiverType.getSimpleName() + "' matches " + arguments.size() + " argument(s)"); + } else { + setError(ErrorType.UNRESOLVED_METHOD, + "Cannot resolve constructor for '" + methodName + "'"); + } } } else if (receiverType != null) { List cParams = resolvedMethod.getParameters();