Skip to content

ScriptCodeCompiler ​

com.jsmacrosce.jsmacros.client.gui.editor.highlighting.scriptimpl.ScriptCodeCompiler

Compiles editor text and autocomplete/context-menu data by executing its configured code-compile script trigger.

Constructors ​

new ScriptCodeCompiler ​

new ScriptCodeCompiler(String language, EditorScreen screen, File scriptFile)#
Stores the syntax language and editor screen, and configures the CodeCompile event trigger for the script file. The trigger is not executed here.

Parameters:

  • language: syntax-language identifier
  • screen: editor that receives compilation outputs
  • scriptFile: configured compiler script file

Methods ​

getRenderedText ​

getRenderedText(): Component[]#
Returns the stored rendered lines. Before recompilation this is a one-element array containing an empty text component; after recompilation each line is cast to a mutable component and its style is replaced with the editor's default style. The returned array is the stored array.
Returns: current rendered-line array

getRightClickOptions ​

getRightClickOptions(int index): Map<String, Runnable>#
Returns the context-menu actions produced by the stored callback for the supplied character index. A missing callback or null callback result yields a new empty map; callback failures are passed to the profile error logger. A non-null callback map is returned by reference without validation.

Parameters:

  • index: code-character index passed to the callback
Returns: callback labels mapped to actions, or a new empty map if no callback or result is available

getSuggestions ​

getSuggestions(): List<AutoCompleteSuggestion>#
Returns the stored autocomplete suggestion list, initially empty and replaced with the list produced by the latest compilation event. The returned list is shared, not copied.
Returns: current suggestion list

recompileRenderedText ​

recompileRenderedText(String text): void#
Runs the configured script with a CodeCompileEvent containing the source text. When an execution container is returned, attempts to await it before consuming the event's rendered lines, context-menu callback, and suggestions. An interrupted or spuriously returning wait can allow output consumption before the handler finishes. Rendered lines must wrap mutable components; their existing styles are replaced with the editor's default style.

Parameters:

  • text: source text supplied to the compilation event