Sets up a new EditSession
and associates it with the given Document
and Mode
.
Emitted when the wrapping limit changes.
Emitted when the wrap mode changes.
Emitted when the current mode changes.
Emitted when an annotation changes, like through EditSession.setAnnotations.
Emitted when a back marker changes.
Emitted when a front marker changes.
Emitted when the gutter changes, either by setting or removing breakpoints, or when the gutter decorations change.
Emitted when the ability to overwrite text changes, via EditSession.setOverwrite.
Emitted when the tab size changes, via EditSession.setTabSize.
Emitted when a code fold is added or removed.
Emitted when the scroll left changes.
Emitted when the scroll top changes.
Emitted when a background tokenizer asynchronously processes new rows.
Emitted when the document changes.
Adds a dynamic marker to the session.
object with update method
Set to true
to establish a front marker
The added marker
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
Identify the type of the marker
Set to true
to establish a front marker
The new marker id
This should generally only be called by the renderer when a resize is detected.
The new wrap limit
Clears 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.
For the given document row and column, returns the screen column.
Converts document coordinates to screen coordinates. {:conversionConsiderations}
The document row to check
The document column to check
The object returned by this method has two properties: row
and column
.
Converts document coordinates to screen coordinates. {:conversionConsiderations}
The object returned by this method has two properties: row
and column
.
For the given document row and column, returns the screen row.
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
.
Gets the range of a word, including its right whitespace.
The row number to start from
The column number to start from
Returns the annotations for the EditSession
.
Returns an array of strings, indicating the breakpoint class (if any) applied to each row.
Returns the Document
associated with this session.
For the given document row and column, this returns the column position of the last screen row.
For the given document row and column, this returns the document position of the last row.
Returns 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.
If true
, indicates you only want front markers; false
indicates only back markers
Returns the current text mode.
The current text mode
Returns true
if keyboard navigation moves the cursor within soft tabs, false
if it moves the cursor over soft tabs.
Returns the current new line mode.
Returns true
if overwrites are enabled; false
otherwise.
Returns 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 getTabSize()
); otherwise it's simply '\t'
.
{:Document.getTextRange.desc}
The range to work with
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.
Returns the current Document
as a string.
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
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 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
.
Returns true
if the character at the position is a soft tab.
The position to check
starts 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 range of text you want moved within the document
The location (row and column) where you want to move the text to
The new range where the text was moved to.
Reloads all the tokens on the current session. This function calls BackgroundTokenizer.start ()
to all the rows; it also emits the 'tokenizerUpdate'
event.
Outdents all the rows defined by the start
and end
properties of range
.
A range of rows
Re-implements a previously undone change to your document.
An array of previous changes
Removes the range
from the document.
A specified Range to remove
The new start
property of the range, which contains startRow
and startColumn
. If range
is empty, this function returns the unmodified value of range.start
.
Removes 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.
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
.
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
screen character x-offset [optional]
The object returned has two properties: row
and column
.
Error:
{
row: 12,
column: 2, //can be undefined
text: "Missing argument",
type: "error" // or "warning" or "info"
}
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
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
{: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 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
Sets the undo manager.
The new undo manager
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'
).
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.
Allow the wrap limit to move freely between min and max. Either
Returns the current Document
as a string.
Sets the value of overwrite to the opposite of whatever it currently is.
Reverts previous changes to your document.
An array of previous changes
{: #dontSelect}
Generated using TypeDoc
Stores all the data about
Editor
state providing easy way to change editors state.EditSession
can be attached to only oneDocument
. SameDocument
can be attached to severalEditSession
s.