Accounted for method parameter count in UsageTracker

This commit is contained in:
bigguy345 committed 2026-01-04 19:07:17 +02:00
1 parent 34379929a5
commit 080b41a3b9
2 files changed
+23

No files matched your search

@@ -395,6 +395,15 @@ public class AutocompleteItem implements Comparable<AutocompleteItem> {
public String getImportPath() { return importPath; }
public int getMatchScore() { return matchScore; }
public int[] getMatchIndices() { return matchIndices; }
public int getParameterCount() {
if (sourceData instanceof MethodInfo) {
return ((MethodInfo) sourceData).getParameterCount();
} else if (sourceData instanceof JSMethodInfo) {
return ((JSMethodInfo) sourceData).getParameterCount();
}
return 0;
}
/**
* Check if this item represents a static member.
@@ -156,6 +156,13 @@ public class UsageTracker {
*/
public void recordUsage(AutocompleteItem item, String ownerFullName) {
String name = item.getSearchName() != null ? item.getSearchName() : item.getName();
// For methods, include parameter count to distinguish overloads
if (item.getKind() == AutocompleteItem.Kind.METHOD) {
int paramCount = item.getParameterCount();
name = name + "(" + paramCount + ")";
}
recordUsage(ownerFullName, name, item.getKind());
}
@@ -177,6 +184,13 @@ public class UsageTracker {
*/
public int getUsageCount(AutocompleteItem item, String ownerFullName) {
String name = item.getSearchName() != null ? item.getSearchName() : item.getName();
// For methods, include parameter count to distinguish overloads
if (item.getKind() == AutocompleteItem.Kind.METHOD) {
int paramCount = item.getParameterCount();
name = name + "(" + paramCount + ")";
}
return getUsageCount(ownerFullName, name, item.getKind());
}