Skip to content

CodeRender ​

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

Since1.3.1Not cancellable

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 ​

new CodeCompileEvent(String code, String language, EditorScreen screen)#
Stores compilation inputs and captures the screen's cursor; does not run the compiler or dispatch the handler.

Parameters:

  • code: source text to render
  • language: syntax-language identifier
  • screen: editor screen supplying the cursor

Fields ​

autoCompleteSuggestions ​

autoCompleteSuggestions: List<AutoCompleteSuggestion>read-only#
Autocomplete suggestions exposed for the current code after handling.

code ​

code: Stringread-only#
Source text supplied for this compilation, rather than a live editor-content accessor.

cursor ​

cursor: SelectCursorread-only#
Cursor object captured from the supplied screen; its state is shared, not copied.

language ​

language: Stringread-only#
Syntax-language identifier supplied for this compilation; it is not necessarily a file extension or supported grammar.

rightClickActions ​

Callback supplying context-menu actions for a character index; null means there are no actions.

screen ​

screen: EditorScreenread-only#
Editor screen supplied for this compilation, retained by reference.

textLines ​

textLines: List<TextHelper>read-only#
Rendered lines to display after handling; each line is reset to the editor's default style.

Methods ​

createMap ​

createMap(): Map<?, ?>#
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 begins
  • suggestion: 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 begins
  • suggestion: replacement text
  • displayText: dropdown text; null uses suggestion
Returns: the created suggestion

createTextBuilder ​

createTextBuilder(): TextBuilder#
Creates a text builder for constructing a rendered line in textLines.
Returns: a new text builder

genPrismNodes ​

genPrismNodes(): List<Prism4j.Node>#
Returns Prism syntax nodes for this code and language; an unsupported language causes a NullPointerException.
Returns: the generated Prism nodes

getThemeData ​

getThemeData(): Map<String, short[]>#
Returns syntax-theme RGB components keyed by token name; the first call initializes and saves default colors if none are configured.
Returns: theme colors keyed by token name, with each color represented by three RGB components