Sets up a new EditSession and associates it with the given Document and Mode.
Optionaltext: string | DocumentOptionalmode: SyntaxModeReturns:
pos;Returns [[Range]]'s for matching tags and tag names, if there are any
Returns the current [[Document Document]] as a string.
OptionalgutterOptionallineOptionalmultiOptionalselectionGet "widgetManager" from EditSession
Set "widgetManager" in EditSession
Adds a dynamic marker to the session.
object with update method
OptionalinFront: booleanSet to true to establish a front marker
The added marker
Optionalcapturing: booleanAdds a new marker to the given Range. If inFront is true, a front marker is defined, and the 'changeFrontMarker' event fires; otherwise, the 'changeBackMarker' event fires.
Define the range of the marker
Set the CSS class for the marker
Optionaltype: "fullLine" | "screenLine" | "text" | "line" | MarkerRendererIdentify the renderer type of the marker. If string provided, corresponding built-in renderer is used. Supported string types are "fullLine", "screenLine", "text" or "line". If a Function is provided, that Function is used as renderer.
OptionalinFront: booleanSet to true to establish a front marker
The new marker id
Converts document coordinates to screen coordinates. {:conversionConsiderations}
The document row to check
OptionaldocColumn: numberThe document column to check
The object returned by this method has two properties: row and column.
Duplicates all the text between firstRow and lastRow.
The starting row to duplicate
The final row to duplicate
Returns the number of new rows added; in other words, lastRow - firstRow + 1.
Returns the annotations for the EditSession.
Returns the string between folds at the given position.
E.g.
foo
where | means the position of row/column
The trim option determs if the return string should be trimed according to the "side" passed with the trim value:
E.g.
foo
Optionaltrim: numberOptionalfoldLine: FoldLineReturns an object containing all of the markers, either front or back.
OptionalinFront: booleanIf true, indicates you only want front markers; false indicates only back markers
Returns the current text mode.
The current text mode
Returns the current new line mode.
OptionaloptionNames: Partial<EditSessionOptions> | (keyof EditSessionOptions)[]Returns the current undo manager.
Indents all the rows, from startRow to endRow (inclusive), by prefixing each row with the token in indentString.
If indentString contains the '\t' character, it's replaced by whatever is defined by [[EditSession.getTabString getTabString()]].
Starting row
Ending row
The indent token
Inserts a block of text and the indicated position.
The position {row, column} to start inserting at
A chunk of text to insert
The position of the last line of text. If the length of text is 0, this function simply returns position.
Shifts all the lines in the document down one, starting from firstRow and ending at lastRow.
The starting row to move down
The final row to move down
If firstRow is less-than or equal to 0, this function returns 0. Otherwise, on success, it returns -1.
Shifts all the lines in the document up one, starting from firstRow and ending at lastRow.
The starting row to move up
The final row to move up
If firstRow is less-than or equal to 0, this function returns 0. Otherwise, on success, it returns -1.
Optionalcapturing: booleanReplaces a range in the document with the new text.
A specified Range to replace
The new text to use as a replacement
An object containing the final row and column, like this:
{row: endRow, column: 0}
If the text and range are empty, this function returns an object containing the current range.start value.
If the text is the exact same as what currently exists, this function returns an object containing the current range.end value.
Converts characters coordinates on the screen to characters coordinates within the document. [This takes into account code folding, word wrap, tab size, and any other visual modifications.]{: #conversionConsiderations}
The screen row to check
The screen column to check
OptionaloffsetX: numberscreen character x-offset [optional]
The object returned has two properties: row and column.
Sets annotations for the EditSession. This functions emits the 'changeAnnotation' event.
A list of annotations
Sets a new text mode for the EditSession. This method also emits the 'changeMode' event. If a [[BackgroundTokenizer BackgroundTokenizer]] is set, the 'tokenizerUpdate' event is also emitted.
Set a new text mode
Optionalcb: () => voidoptional callback
{:Document.setNewLineMode.desc}
Pass in true to enable overwrites in your session, or false to disable.
If overwrites is enabled, any text you enter will type over any text after it. If the value of overwrite changes, this function also emits the changeOverwrite event.
Defines whether or not to set overwrites
Sets the undo manager.
The new undo manager
Sets the boundaries of wrap. Either value can be null to have an unconstrained wrap, or, they can be the same number to pin the limit. If the wrap limits for min or max are different, this method also emits the 'changeWrapMode' event.
The minimum wrap value (the left side wrap)
The maximum wrap value (the right side wrap)
Start an Ace operation, which will then batch all the subsequent changes (to either content or selection) under a single atomic operation.
OptionalcommandEvent: { args?: any; command?: { name?: string } }Optional name for the operation
StaticfromJSONReturns a new instance of EditSession with state from JSON.
The EditSession state.
Stores all the data about [[Editor
Editor]] state providing easy way to change editors state.EditSessioncan be attached to only one [[DocumentDocument]]. SameDocumentcan be attached to severalEditSessions.