TextEditor

interface TextEditor(source)

Represents an editor that is attached to a document.

Online Documentation

Types

Link copied to clipboard
interface EditOptions
Link copied to clipboard

Properties

Link copied to clipboard
abstract val document: TextDocument

The document associated with this text editor. The document will be the same for the entire lifetime of this text editor.

Link copied to clipboard

Text editor options.

Link copied to clipboard
abstract var selection: Selection

The primary selection on this text editor. Shorthand for TextEditor.selections[0].

Link copied to clipboard

The selections in this text editor. The primary selection is always at index 0.

Link copied to clipboard
abstract val viewColumn: ViewColumn?

The column in which this editor shows. Will be undefined in case this isn't one of the main editors, e.g. an embedded editor, or when the editor column is larger than three.

Link copied to clipboard

The current visible ranges in the editor (vertically). This accounts only for vertical scrolling, and not for horizontal scrolling.

Functions

Link copied to clipboard
abstract fun edit(callback: (editBuilder: TextEditorEdit) -> Unit, options: TextEditor.EditOptions = definedExternally): PromiseLike<JsBoolean>

Perform an edit on the document associated with this text editor.

Link copied to clipboard
abstract fun insertSnippet(    snippet: SnippetString,     location: JsAny = definedExternally,     options: TextEditor.InsertSnippetOptions = definedExternally): PromiseLike<JsBoolean>

Insert a snippet and put the editor into snippet mode. "Snippet mode" means the editor adds placeholders and additional cursors so that the user can complete or accept the snippet.

Link copied to clipboard
abstract fun revealRange(range: Range, revealType: TextEditorRevealType = definedExternally)

Scroll as indicated by revealType in order to reveal the given range.

Link copied to clipboard
abstract fun setDecorations(decorationType: TextEditorDecorationType, rangesOrOptions: JsAny)

Adds a set of decorations to the text editor. If a set of decorations already exists with the given decoration type, they will be replaced. If rangesOrOptions is empty, the existing decorations with the given decoration type will be removed.