Source
Source interface for filter source contents.
Methods
Section titled “Methods”content()
Section titled “content()”content():
string
Content returns the source content represented as a string. Example contents are the single file contents, textbox field, or url parameter.
Returns
Section titled “Returns”string
description()
Section titled “description()”description():
string
Description gives a brief description of the source. Example descriptions are a file name or ui element.
Returns
Section titled “Returns”string
lineOffsets()
Section titled “lineOffsets()”lineOffsets():
number[]
LineOffsets gives the character offsets at which lines occur. The zero-th entry should refer to the break between the first and second line, or EOF if there is only one line of source.
Returns
Section titled “Returns”number[]
location()
Section titled “location()”location(
line,column):Location
Location takes an input line and column and produces a Location. The default behavior is to treat the line and column as absolute, but concrete derivations may use this method to convert a relative line and column position into an absolute location.
Parameters
Section titled “Parameters”number
column
Section titled “column”number
Returns
Section titled “Returns”locationOffset()
Section titled “locationOffset()”locationOffset(
location): [number,boolean]
LocationOffset translates a Location to an offset. Given the line and column of the Location returns the Location’s character offset in the Source, and a bool indicating whether the Location was found.
Parameters
Section titled “Parameters”location
Section titled “location”Returns
Section titled “Returns”[number, boolean]
offsetLocation()
Section titled “offsetLocation()”offsetLocation(
offset): [Location,boolean]
OffsetLocation translates a character offset to a Location, or false if the conversion was not feasible.
Parameters
Section titled “Parameters”offset
Section titled “offset”number
Returns
Section titled “Returns”[Location, boolean]
snippet()
Section titled “snippet()”snippet(
line): [string,boolean]
Snippet returns a line of content and whether the line was found.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”[string, boolean]