Add Script Context and better parsing for d.ts handling

This commit is contained in:
Kam committed 2026-01-09 22:59:13 -05:00
1 parent a5c02e6c94
commit 78f7fa65f1
13 files changed
+831 -67

No files matched your search

@@ -25,6 +25,7 @@ import noppes.npcs.client.gui.util.ITextChangeListener;
import noppes.npcs.client.gui.util.ITextfieldListener;
import noppes.npcs.controllers.ScriptContainer;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.constants.ScriptContext;
import noppes.npcs.controllers.data.ForgeDataScript;
import noppes.npcs.controllers.data.IScriptHandler;
import noppes.npcs.scripted.item.ScriptCustomItem;
@@ -197,6 +198,9 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
// Set the scripting language for proper syntax highlighting
activeArea.setLanguage(this.handler.getLanguage());
// Set the script context for context-aware hook autocomplete
activeArea.setScriptContext(getScriptContext());
// Setup fullscreen key binding
GuiScriptTextArea.KEYS.FULLSCREEN.setTask(e -> {
if (e.isPress()) {
@@ -513,6 +517,16 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
this.initGui();
}
/**
* Get the script context for this GUI.
* Override in subclasses to return the appropriate context.
*
* @return The script context (default: GLOBAL)
*/
protected ScriptContext getScriptContext() {
return ScriptContext.GLOBAL;
}
public void save() {
if (loaded)
this.setScript();