# Class CodeCompletion

java.lang.Object
com.codename1.ui.CodeCompletion

public class CodeCompletion extends Object
A single code completion proposal returned by a `CodeCompletionProvider` and shown in the `CodeEditor` completion popup.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CodeCompletion(String text)`
  Creates a completion whose displayed and inserted text are identical.
  `CodeCompletion(String displayText, String insertText)`
  Creates a completion with distinct display and insertion text.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getDetail()`
  Optional secondary detail (e.g. a method signature or return type) shown alongside the entry.
  `String`
  `getDisplayText()`
  The text shown to the user in the completion popup.
  `String`
  `getInsertText()`
  The text inserted into the editor when this completion is accepted.
  `String`
  `getType()`
  An optional category used to badge / icon the entry, e.g.
  `CodeCompletion`
  `setDetail(String detail)`
  Sets the optional secondary detail.
  `CodeCompletion`
  `setType(String type)`
  Sets the completion category.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CodeCompletion

    public CodeCompletion(String text)

    Creates a completion whose displayed and inserted text are identical.

    ###### Parameters

    - `text`: the text shown in the popup and inserted when chosen

  - ### CodeCompletion

    public CodeCompletion(String displayText, String insertText)

    Creates a completion with distinct display and insertion text.

    ###### Parameters

    - `displayText`: the text shown in the completion popup

    - `insertText`: the text inserted into the editor when this completion is chosen

- ## Method Details

  - ### getDisplayText

    public String getDisplayText()
    The text shown to the user in the completion popup.

  - ### getInsertText

    public String getInsertText()
    The text inserted into the editor when this completion is accepted.

  - ### getType

    public String getType()
    An optional category used to badge / icon the entry, e.g. `"method"`, `"keyword"`, `"variable"`, `"class"`, `"snippet"`.

  - ### setType

    public CodeCompletion setType(String type)

    Sets the completion category. Returns this for chaining.

    ###### Parameters

    - `type`: the completion category

  - ### getDetail

    public String getDetail()
    Optional secondary detail (e.g. a method signature or return type) shown alongside the entry.

  - ### setDetail

    public CodeCompletion setDetail(String detail)

    Sets the optional secondary detail. Returns this for chaining.

    ###### Parameters

    - `detail`: the detail string