mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 20:07:32 +00:00
Fixed error hover info for enums being broken
This commit is contained in:
1 parent
1c3a11d433
commit
bc6e9786da
2 files changed
+12
-3
No files matched your search
+9
-3
@@ -184,7 +184,7 @@ public class TokenHoverInfo {
|
||||
}
|
||||
|
||||
// Show method-level errors if this is the method name itself
|
||||
MethodCallInfo callInfo = token.getMethodCallInfo();
|
||||
MethodCallInfo callInfo = token.isEnumConstant()? containingCall : token.getMethodCallInfo();
|
||||
if (callInfo != null) {
|
||||
if (callInfo.hasArgCountError()) {
|
||||
errors.add(callInfo.getErrorMessage());
|
||||
@@ -337,12 +337,18 @@ public class TokenHoverInfo {
|
||||
|
||||
ScriptDocument doc = line.getParent();
|
||||
int tokenStart = token.getGlobalStart();
|
||||
|
||||
|
||||
for (MethodCallInfo call : doc.getMethodCalls()) {
|
||||
boolean isWithinName = tokenStart >= call.getMethodNameStart() && tokenStart <= call.getMethodNameEnd();
|
||||
|
||||
// If this is an enum constant, return methodCall on name itself
|
||||
if (token.isEnumConstant() && isWithinName)
|
||||
return call;
|
||||
|
||||
// Check if token is within the argument list
|
||||
if (tokenStart >= call.getOpenParenOffset() && tokenStart <= call.getCloseParenOffset()) {
|
||||
// Make sure it's not the method name itself
|
||||
if (tokenStart >= call.getMethodNameStart() && tokenStart <= call.getMethodNameEnd()) {
|
||||
if (isWithinName) {
|
||||
continue;
|
||||
}
|
||||
return call;
|
||||
|
||||
@@ -206,6 +206,9 @@ public class Token {
|
||||
type == TokenType.ENUM_DECL;
|
||||
}
|
||||
|
||||
public boolean isEnumConstant() {
|
||||
return type == TokenType.ENUM_CONSTANT;
|
||||
}
|
||||
public boolean isResolved() {
|
||||
if (typeInfo != null) return typeInfo.isResolved();
|
||||
if (fieldInfo != null) return fieldInfo.isResolved();
|
||||
|
||||
Reference in new issue
Block a user