# CodeRender

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

**Since:** 1.3.1

**Cancellable:** No. Calling `event.cancel()` throws `UnsupportedOperationException`.

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 {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.scriptimpl.CodeCompileEvent_constructor-String-String-EditorScreen-}

```js
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 {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.scriptimpl.CodeCompileEvent_autoCompleteSuggestions}

```js
autoCompleteSuggestions: List<AutoCompleteSuggestion>
```

Autocomplete suggestions exposed for the current code after handling.

### code {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.scriptimpl.CodeCompileEvent_code}

```js
code: String
```

Source text supplied for this compilation, rather than a live editor-content accessor.

### cursor {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.scriptimpl.CodeCompileEvent_cursor}

```js
cursor: SelectCursor
```

Cursor object captured from the supplied screen; its state is shared, not copied.

### language {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.scriptimpl.CodeCompileEvent_language}

```js
language: String
```

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

### rightClickActions {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.scriptimpl.CodeCompileEvent_rightClickActions}

```js
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 {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.scriptimpl.CodeCompileEvent_screen}

```js
screen: EditorScreen
```

Editor screen supplied for this compilation, retained by reference.

### textLines {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.scriptimpl.CodeCompileEvent_textLines}

```js
textLines: List<TextHelper>
```

Rendered lines to display after handling; each line is reset to the editor's default style.

## Methods

### createMap {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.scriptimpl.CodeCompileEvent_createMap-}

```js
createMap(): Map<?, ?>
```

Creates an insertion-ordered map suitable as the result of [rightClickActions](#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.scriptimpl.CodeCompileEvent_rightClickActions).

**Returns:** an empty insertion-ordered map

### createPrefixTree {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.scriptimpl.CodeCompileEvent_createPrefixTree-}

```js
createPrefixTree(): StringHashTrie
```

Creates an empty prefix tree for autocomplete data.

**Returns:** an empty prefix tree

### createSuggestion {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.scriptimpl.CodeCompileEvent_createSuggestion-int-String-}

```js
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 {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.scriptimpl.CodeCompileEvent_createSuggestion-int-String-TextHelper-}

```js
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 {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.scriptimpl.CodeCompileEvent_createTextBuilder-}

```js
createTextBuilder(): TextBuilder
```

Creates a text builder for constructing a rendered line in [textLines](#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.scriptimpl.CodeCompileEvent_textLines).

**Returns:** a new text builder

### genPrismNodes {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.scriptimpl.CodeCompileEvent_genPrismNodes-}

```js
genPrismNodes(): List<Prism4j.Node>
```

Returns Prism syntax nodes for this code and language; an unsupported language causes a [NullPointerException](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/NullPointerException.html).

**Returns:** the generated Prism nodes

### getThemeData {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.scriptimpl.CodeCompileEvent_getThemeData-}

```js
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
