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

@@ -22,6 +22,7 @@ import noppes.npcs.client.gui.util.script.interpreter.hover.HoverState;
import noppes.npcs.client.gui.util.script.interpreter.hover.TokenHoverRenderer;
import noppes.npcs.client.gui.util.script.autocomplete.AutocompleteManager;
import noppes.npcs.client.key.impl.ScriptEditorKeys;
import noppes.npcs.constants.ScriptContext;
import noppes.npcs.util.ValueUtil;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
@@ -2629,6 +2630,27 @@ public class GuiScriptTextArea extends GuiNpcTextField {
return this.container != null ? this.container.getLanguage() : "ECMAScript";
}
/**
* Set the script context (NPC, PLAYER, BLOCK, ITEM, etc.).
* This determines which hooks and event types are available for autocomplete.
*
* @param context The script context
*/
public void setScriptContext(ScriptContext context) {
if (this.container != null) {
this.container.setScriptContext(context);
}
}
/**
* Get the current script context.
*
* @return The script context (NPC, PLAYER, BLOCK, ITEM, etc.)
*/
public ScriptContext getScriptContext() {
return this.container != null ? this.container.getScriptContext() : ScriptContext.GLOBAL;
}
public void setListener(ITextChangeListener listener) {
this.listener = listener;
}