# AutoCompleteSuggestion

`com.jsmacrosce.jsmacros.client.gui.editor.highlighting.AutoCompleteSuggestion`

Describes an editor autocomplete replacement and its dropdown label.  
```js
const Suggestion = Java.type("com.jsmacrosce.jsmacros.client.gui.editor.highlighting.AutoCompleteSuggestion");  
const item = new Suggestion(0, "Chat.log");  
```

## Constructors

### new AutoCompleteSuggestion {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.AutoCompleteSuggestion_constructor-int-String-}

```js
new AutoCompleteSuggestion(int startIndex, String suggestion)
```

Creates a suggestion whose label is styled from its replacement text.

**Parameters:**
- `startIndex`: zero-based UTF-16 index where replacement begins
- `suggestion`: replacement string

### new AutoCompleteSuggestion {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.AutoCompleteSuggestion_constructor-int-String-Component-}

```js
new AutoCompleteSuggestion(int startIndex, String suggestion, Component displayText)
```

Uses the supplied component as the dropdown label, separately from the replacement string.

**Parameters:**
- `startIndex`: zero-based UTF-16 index where replacement begins
- `suggestion`: replacement string
- `displayText`: component shown in the dropdown

## Fields

### displayText {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.AutoCompleteSuggestion_displayText}

```js
displayText: Component
```

Component shown as the dropdown label; it need not match `suggestion`.

### startIndex {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.AutoCompleteSuggestion_startIndex}

```js
startIndex: int
```

Zero-based UTF-16 index where replacement begins; acceptance replaces through the cursor index.

### suggestion {#com.jsmacrosce.jsmacros.client.gui.editor.highlighting.AutoCompleteSuggestion_suggestion}

```js
suggestion: String
```

String inserted in place of the text from `startIndex` to the cursor.
