CodeRender
com.jsmacrosce.jsmacros.client.gui.editor.highlighting.scriptimpl.CodeCompileEvent
Event passed to the editor's script-based code compiler. Populate its rendered lines, autocomplete suggestions, and optional context-menu callback while handling it; the editor reads these outputs after the handler completes.
Constructors
new CodeCompileEvent
Fields
autoCompleteSuggestions
Autocomplete suggestions exposed for the current code after handling.
code
cursor
Cursor object captured from the supplied screen; its state is shared, not copied.
language
rightClickActions
rightClickActions: MethodWrapper<Integer, Object, Map<String, MethodWrapper<Object, Object, Object, ?>>, ?>#Callback supplying context-menu actions for a character index;
null means there are no actions.screen
Editor screen supplied for this compilation, retained by reference.
textLines
Rendered lines to display after handling; each line is reset to the editor's default style.
Methods
createMap
Creates an insertion-ordered map suitable as the result of rightClickActions.
Returns: an empty insertion-ordered map
createPrefixTree
createPrefixTree(): StringHashTrie#Creates an empty prefix tree for autocomplete data.
Returns: an empty prefix tree
createSuggestion
createSuggestion(int startIndex, String suggestion): AutoCompleteSuggestion#Creates an autocomplete suggestion using its suggestion text as the display text.
Parameters:
startIndex: index in the code at which the replaced portion beginssuggestion: replacement text
Returns: the created suggestion
createSuggestion(int startIndex, String suggestion, TextHelper displayText): AutoCompleteSuggestion#Creates an autocomplete suggestion, optionally with separate dropdown display text.
Parameters:
startIndex: index in the code at which the replaced portion beginssuggestion: replacement textdisplayText: dropdown text;nullusessuggestion
Returns: the created suggestion
createTextBuilder
createTextBuilder(): TextBuilder#Creates a text builder for constructing a rendered line in textLines.
Returns: a new text builder
genPrismNodes
Returns Prism syntax nodes for this code and language; an unsupported language causes a NullPointerException.
Returns: the generated Prism nodes