Skip to main content
Version: Next 🚧

[I] ServerSourceFile

Extends

Properties

PropertyModifierTypeDescriptionInherited from
document?readonlyTextDocument--
pathreadonlystringThe source file path. This is used only for diagnostics. The command line compiler will populate it with the actual path from which the file was read, but it can actually be an arbitrary name for other scenarios.SourceFile.path
textreadonlystringThe source code text.SourceFile.text

Methods

getLineAndCharacterOfPosition()

getLineAndCharacterOfPosition(position): LineAndCharacter

Converts a one-dimensional position in the document (measured in UTF-16 code units) to line number and offset from line start.

Parameters

ParameterType
positionnumber

Returns

LineAndCharacter

Inherited from

SourceFile.getLineAndCharacterOfPosition


getLineStarts()

getLineStarts(): readonly number[]

Array of positions in the text where each line begins. There is one entry per line, in order of lines, and each entry represents the offset in UTF-16 code units from the start of the document to the beginning of the line.

Returns

readonly number[]

Inherited from

SourceFile.getLineStarts