Skip to content

Editor.setSelections method

Editor › setSelections

Official

Set the selections.

Signature:

setSelections(ranges: EditorSelectionOrCaret[], main?: number | undefined): void

Parameters:

Parameter Type Description
ranges EditorSelectionOrCaret[] The ranges to set the selections to.
main? number | undefined The main selection index.

Returns: void

Since: 0.12.11

Example:

editor.setSelections([
{ anchor: { line: 12, ch: 3 }, head: { line: 23, ch: 4 } },
{ anchor: { line: 34, ch: 5 }, head: { line: 45, ch: 6 } }
], 1);