Add ShowImplementationFieldsInAutocomplete config

This commit is contained in:
bigguy345 committed 2026-02-25 17:13:35 +02:00
1 parent 4d08f85419
commit 6c45957b82
2 files changed
+10 -1

No files matched your search

@@ -5,6 +5,7 @@ import noppes.npcs.client.gui.util.script.interpreter.field.FieldInfo;
import noppes.npcs.client.gui.util.script.interpreter.type.synthetic.*;
import noppes.npcs.client.gui.util.script.interpreter.type.TypeChecker;
import noppes.npcs.client.gui.util.script.interpreter.type.TypeInfo;
import noppes.npcs.config.ConfigScript;
import java.util.*;
@@ -66,7 +67,7 @@ public class JSAutocompleteProvider extends JavaAutocompleteProvider {
if (jsTypeInfo != null) {
// Pass both: jsTypeInfo (current type in hierarchy) and receiverType (context for type params)
addMethodsFromType(jsTypeInfo, receiverType, items, new HashSet<>(), context.methodsOnly);
if (!context.methodsOnly) {
if (!context.methodsOnly && ConfigScript.ShowImplementationFieldsInAutocomplete) {
addFieldsFromType(jsTypeInfo, receiverType, items, new HashSet<>());
}
}
@@ -66,6 +66,9 @@ public class ConfigScript {
public static Property ClearActionsOnDeathProperty;
public static boolean ClearActionsOnDeath = true;
public static Property ShowImplementationFieldsInAutocompleteProperty;
public static boolean ShowImplementationFieldsInAutocomplete = false;
public static boolean IndividualPlayerScripts = false;
public static void init(File configFile) {
@@ -131,6 +134,11 @@ public class ConfigScript {
ClearActionsOnDeathProperty = config.get(CUSTOMIZATION, "Clear Actions On Death", true, "If true, clears the Action Manager for players and NPCs when they die");
ClearActionsOnDeath = ClearActionsOnDeathProperty.getBoolean(true);
ShowImplementationFieldsInAutocompleteProperty = config.get(CUSTOMIZATION, "Autocomplete Implementation Fields", false,
"If true, TypeScript (.d.ts) interface fields that come from implementation classes (not the API contract)\n" +
"will be shown directly in JS autocomplete. These fields are still parsed and type-resolved either way.");
ShowImplementationFieldsInAutocomplete = ShowImplementationFieldsInAutocompleteProperty.getBoolean(false);
// Convert to Legacy
if (CustomNpcs.legacyExist) {
ScriptingEnabled = LegacyConfig.ScriptingEnabled;