TextDocument
- class TextDocument
A basic text document that holds source text and allows conversions between encoded text positions and byte offsets.
Note that the only way to update contents is through
.updatemethod.Members defined in
TextDocument(13 members)RLanguage identifier of this text document.
RNumber of lines in this text document.
RFull source of this text document.
RLocation this text corresponds to.
RCurrent version of this text document.
Create an empty
TextDocumentfor multi-threaded applicationsCreate an empty
TextDocumentfor single-threaded applicationsGet text corresponding to the given Utf-8 range.
Get byte offset at Utf-8 position.
Apply edits to the
contentsof this text documents.Get Utf-16 position at the given byte offset.
Get Utf-32 position at the given byte offset.
Get Utf-8 position at the given byte offset.
Attributes
- property url: syside.Url
Location this text corresponds to.
Methods
- static create_mt() syside.SharedMutex[syside.TextDocument]
- static create_mt(url: syside.Url, language: str, content: str, version: int = 0) syside.SharedMutex[syside.TextDocument]
Create an empty
TextDocumentfor multi-threaded applications
- static create_st() syside.SharedMutex[syside.TextDocument]
- static create_st(url: syside.Url, language: str, content: str, version: int = 0) syside.SharedMutex[syside.TextDocument]
Create an empty
TextDocumentfor single-threaded applications
- get_text(range: syside.RangeUtf8) str
Get text corresponding to the given Utf-8 range.
- get_text(range: syside.RangeUtf16) str
Get text corresponding to the given Utf-16 range.
- get_text(range: syside.RangeUtf32) str
Get text corresponding to the given Utf-32 range.
- offset_at(position: syside.PositionUtf8) int
Get byte offset at Utf-8 position.
- offset_at(position: syside.PositionUtf16) int
Get byte offset at Utf-16 position.
- offset_at(position: syside.PositionUtf32) int
Get byte offset at Utf-32 position.
- update(changes: Sequence[syside.TextDocumentEditUtf8], version: int | None = None) None
Apply edits to the
contentsof this text documents.Updates the version to the given value, or increments an existing version.
- utf16_position_at(offset: int) syside.PositionUtf16
Get Utf-16 position at the given byte offset.
- utf32_position_at(offset: int) syside.PositionUtf32
Get Utf-32 position at the given byte offset.
- utf8_position_at(offset: int) syside.PositionUtf8
Get Utf-8 position at the given byte offset.