TextDocuments

class TextDocuments

A thread-safe registry for TextDocuments.

Members defined in TextDocuments (14 members)

__getitem__

change_content

Update contents of the text document at url.

close

Remove a document at url from this registry.

create_mt

Create TextDocuments for multi-threaded applications

create_st

Create TextDocuments for single-threaded applications

find_or_open

Find an existing document, or open a new one if either url does not exist, or an existing document has a different language.

move

Move document from src to dst.

open

Open a new text document.

save

Signal that document at url has been saved.

visit

Visit all text documents in the registry.

visit_documents

Visit all text documents in the registry.

visit_urls

Visit all reachable urls in the registry.

will_save

Signal that document at url will be saved.

will_save_wait_until

Signal that document at url has been saved and wait until corresponding handler completes.

Methods

__getitem__(url: syside.Url) syside.SharedMutex[syside.TextDocument]
change_content(url: syside.Url, changes: Sequence[syside.TextDocumentEditUtf8], version: int | None = None) None

Update contents of the text document at url.

close(url: syside.Url) syside.SharedMutex[syside.TextDocument] | None

Remove a document at url from this registry.

static create_mt() syside.TextDocuments

Create TextDocuments for multi-threaded applications

static create_st() syside.TextDocuments

Create TextDocuments for single-threaded applications

find_or_open(url: syside.Url, language: str, data: Callable[[], syside.PartialTextDocumentData]) tuple[syside.SharedMutex[syside.TextDocument], bool]

Find an existing document, or open a new one if either url does not exist, or an existing document has a different language.

The second return value is only True if a new document was opened, and False if an existing document was found.

move(src: syside.Url, dst: syside.Url) syside.SharedMutex[syside.TextDocument] | None

Move document from src to dst.

If src exists, steals its contents and creates a new document at dst and returns the new document. Note that any references to the old document at src will not be updated to dst.

This overwrites existing document at dst if src exits.

open(url: syside.Url, language: str, content: str, version: int = 0) syside.SharedMutex[syside.TextDocument]

Open a new text document.

This overwrites any text document already at url.

open(arg: syside.TextDocumentData, /) syside.SharedMutex[syside.TextDocument]
save(url: syside.Url) None

Signal that document at url has been saved.

visit(visitor: Callable[[syside.Url, syside.SharedMutex[syside.TextDocument]], None]) None

Visit all text documents in the registry.

visit_documents(visitor: Callable[[syside.SharedMutex[syside.TextDocument]], None]) None

Visit all text documents in the registry.

visit_urls(visitor: Callable[[syside.Url], None]) None

Visit all reachable urls in the registry.

will_save(url: syside.Url, reason: syside.TextDocumentSaveReason) None

Signal that document at url will be saved.

will_save_wait_until(url: syside.Url, reason: syside.TextDocumentSaveReason) list[syside.TextEdit]

Signal that document at url has been saved and wait until corresponding handler completes.

Used in