Sets up a new EditSession and associates it with the given Document and Mode.
Optionaltext: string | DocumentOptionalmode: string | Ace.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 fold. The new created Fold object or an existing fold object in case the passed in range fits an existing fold exactly.
Optionalrange: RangeExperimentalReplaces the fold widget if present with the custom icon from a specific row in the gutter
The row number where the widget will be displayed
Configuration attributes for the widget
Event callback functions for the widget e.g onClick;
CSS class name for styling the widget
Text label to display in the widget
Tooltip text for the widget
Adds className to the row, to be used for CSS stylings and whatnot.
The row number
The class to add
Adds 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: "line" | "text" | "fullLine" | "screenLine" | 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
Optionaltype: stringThis should generally only be called by the renderer when a resize is detected.
The new wrap limit
Optional$printMargin: anyClears all the annotations for this session. This function also triggers the 'changeAnnotation' event.
Removes a breakpoint on the row number given by row. This function also emits the 'changeBreakpoint' event.
A row index
Removes all breakpoints on the rows. This function also emits the 'changeBreakpoint' event.
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.
End current Ace operation.
Emits "beforeEndOperation" event just before clearing everything, where the current operation can be accessed through curOp property.
Optionale: anyOptionalstartRow: numberOptionalendRow: numberOptionaldepth: numberOptionaltest: FunctionReturns all folds in the document
Returns the annotations for the EditSession.
Gets the range of a word, including its right whitespace.
The row number to start from
The column number to start from
Returns an array of strings, indicating the breakpoint class (if any) applied to each row.
Optionaldir: numberReturns the Document associated with this session.
For the given document row and column, this returns the column position of the last screen row.
Looks up a fold at a given row/column. Possible values for side: -1: ignore a fold if fold.start = row/column +1: ignore a fold if fold.end = row/column
Optionalside: numberOptionalstartFoldLine: FoldLineReturns 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 the number of rows in the document.
Returns a verbatim copy of the given line as it is in the document
The row to retrieve from
Returns an array of strings of the rows between firstRow and lastRow. This function is inclusive of lastRow.
The first row index to retrieve
The final row index to retrieve
Returns 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 true if keyboard navigation moves the cursor within soft tabs, false if it moves the cursor over soft tabs.
Returns the fold which starts after or contains docRow
OptionalstartFoldLine: FoldLineOptionaloptionNames: Partial<EditSessionOptions> | (keyof EditSessionOptions)[]Returns true if overwrites are enabled; false otherwise.
the last character preceding the cursor in the editor
OptionalstartFoldRow: FoldLineOptionalstartFoldRow: FoldLineReturns number of screenrows in a wrapped line.
The row number to check
For the given row, this returns the split data.
Returns the position (on screen) for the last character in the provided screen row.
The screen row to check
Returns the length of the screen.
The distance to the next tab stop at the specified screen column.
The screen column to check
Returns the width of the screen.
[Returns the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.getScrollLeft}
[Returns the value of the distance between the top of the editor and the topmost part of the visible content.]{: #EditSession.getScrollTop}
Returns selection object.
{:BackgroundTokenizer.getState}
The row to start at
Returns the current tab size.
Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by [[EditSession.getTabSize getTabSize()]]); otherwise it's simply '\t'.
Returns an object indicating the token at the current row. The object has two properties: index and start.
The row number to retrieve from
The column number to retrieve from
Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows.
The row to start at
Returns the current undo manager.
Returns true if soft tabs are being used, false otherwise.
Returns true if workers are being used.
Returns true if wrap mode is being used; false otherwise.
Given a starting row and column, this method returns the Range of the first word boundary it finds.
The row to start at
The column to start at
Returns the value of wrap limit.
The wrap limit.
Returns an object that defines the minimum and maximum of the wrap limit; it looks something like this:
{ min: wrapLimitRange_min, max: wrapLimitRange_max }
experimental
OptionalinFront: booleanIndents 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
Checks if a given documentRow is folded. This is true if there are some folded parts such that some parts of the line is still visible.
OptionalstartFoldRow: FoldLinestarts a new group in undo history
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.
Moves a range of text from the given range to the given position. toPosition is an object that looks like this:
{ row: newRowLocation, column: newColumnLocation }
The new range where the text was moved to.
Optionalcapturing: booleanOutdents all the rows defined by the start and end properties of range.
A range of rows
Optionalname: stringRemoves a range of full lines. This method also triggers the 'change' event.
The first row to be removed
The last row to be removed
Returns all the removed lines.
ExperimentalReplaces the custom icon with the fold widget if present from a specific row in the gutter
The row number for which to hide the custom icon
Removes className from the row.
The row number
The class to add
Removes the marker with the specified ID. If this marker was in front, the 'changeFrontMarker' event is emitted. If the marker was in the back, the 'changeBackMarker' event is emitted.
A number representing a marker
Replaces a range in the document with the new text.
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 breakpoint on the row number given by row. This function also emits the 'changeBreakpoint' event.
A row index
Class of the breakpoint
Sets a breakpoint on every row number given by rows. This function also emites the 'changeBreakpoint' event.
An array of row indices
Sets the EditSession to point to a new Document. If a BackgroundTokenizer exists, it also points to doc.
The new Document to use
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
Set whether keyboard navigation of soft tabs moves the cursor within the soft tab, rather than over
Value indicating whether or not to navigate within soft tabs
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 value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.setScrollLeft}
This function sets the scroll top value. It also emits the 'changeScrollTop' event.
The new scroll top value
Set the number of spaces that define a soft tab; for example, passing in 4 transforms the soft tabs to be equivalent to four spaces. This function also emits the changeTabSize event.
The new tab size
Enables or disables highlighting of the range where an undo occurred.
If true, selects the range of the reinserted change
Pass true to enable the use of soft tabs. Soft tabs means you're using spaces instead of the tab character ('\t').
Value indicating whether or not to use soft tabs
Identifies if you want to use a worker for the EditSession.
Set to true to use a worker
Sets whether or not line wrapping is enabled. If useWrapMode is different than the current value, the 'changeWrapMode' event is emitted.
Enable (or disable) wrap mode
Sets the session text.
The new text to place
Sets the line length for soft wrap in the editor. Lines will break at a minimum of the given length minus 20 chars and at a maximum of the given number of chars.
The maximum line length in chars, for soft wrapping lines.
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
OptionaltryToUnfold: booleanOptionaltoggleParent: booleanSets the value of overwrite to the opposite of whatever it currently is.
StaticfromReturns 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.