A widget that provides a code editor.

As of JupyterLab 4.0.0, it is not possible to provide an editor that is different of CodeMirror 6.

Hierarchy

Properties

charWidth: number

The widget of a character in the editor in pixels.

A signal emitted when either the top or bottom edge is requested.

The DOM node that hosts the editor.

isDisposed: boolean

Test whether the object has been disposed.

Notes

This property is always safe to access.

lineCount: number

Get the number of lines in the editor.

lineHeight: number

The height of a line in the editor in pixels.

The model used by the editor.

uuid: string

The uuid of this selection owner.

Methods

  • Dispose of the resources held by the object.

    Notes

    If the object's dispose method is called more than once, all calls made after the first will be a no-op.

    Undefined Behavior

    It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

    Returns void

  • Returns the content for the given line number.

    Parameters

    • line: number

      The line of interest.

    Returns string

    The value of the line.

    Notes

    Lines are 0-based, and accessing a line out of range returns undefined.

  • Find an offset for the given position.

    Parameters

    • position: IPosition

      The position of interest.

    Returns number

    The offset at the position, clamped to the extent of the editor contents.

  • Set the primary position of the cursor.

    Parameters

    • position: IPosition

      The new primary position.

    • Optional options: {
          scroll?: boolean;
      }

      Adjustment options allowing to disable scrolling.

      Notes

      This will remove any secondary cursors.

      • Optional scroll?: boolean

    Returns void

Generated using TypeDoc