Foundry.TextDocument¶
- Subclasses:
None
Methods¶
- Inherited:
Foundry.Contextual (4), GObject.Object (37), Json.Serializable (8)
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r |
|||
r/w/co |
|||
r/w/co |
|||
r/w/co |
|||
r |
|||
r |
Signals¶
- Inherited:
Name |
Short Description |
|---|---|
This signal is emitted after the document has been saved to file. |
Fields¶
- Inherited:
Class Details¶
- class Foundry.TextDocument(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Represents a text document in the development environment with editing capabilities.
Foundry.TextDocumentmanages the lifecycle of text documents including loading, saving, and modification tracking. It integrates with the text buffer system and provides document-level services such as diagnostics, settings, and extension management for enhanced editing functionality.- apply_edit(edit)¶
- Parameters:
edit (
Foundry.TextEdit) –- Return type:
- apply_edits(edits, n_edits)¶
- Parameters:
edits (
Foundry.TextEdit) –n_edits (
int) –
- Return type:
- diagnose()¶
- Returns:
a [class`Dex`.Future] that resolves to a [iface`Gio`.ListModel] of [class`Foundry`.Diagnostic].
- Return type:
Queries [class`Foundry`.DiagnosticProvider] for diagnostics that are relevant to the document.
This does a single-shot run of diagnostics.
To monitor diagnostics for changes, use [method`Foundry`.TextDocument.watch_diagnostics] which will update as the document changes.
- dup_buffer()¶
- Returns:
a [iface`Foundry`.TextBuffer].
- Return type:
Gets the underlying [iface`Foundry`.TextBuffer].
- dup_file()¶
-
Gets the underlying [iface`Gio`.File].
- dup_uri()¶
- Returns:
a UTF-8 encoded string containing the URI
- Return type:
Convenience function to get the URI of a file.
- find_addin(module_name)¶
- Parameters:
module_name (
str) – the name of the plugin module- Return type:
Gets a [class`Foundry`.TextDocumentAddin] using the name of the plugin. This is the value for “Module=” in the
.pluginfile.
- find_symbol_at(line, line_offset)¶
- Parameters:
- Returns:
a [class`Dex`.Future] that resolves to a [class`Foundry`.Symbol] or rejects with error.
- Return type:
Queries [class`Foundry`.SymbolProvider] for a symbol at the specified position in the document.
New in version 1.1.
- list_addins()¶
- Return type:
- list_code_actions()¶
- Returns:
a [class`Dex`.Future] that resolves to a [iface`Gio`.ListModel] of [class`Foundry`.CodeAction].
- Return type:
Queries [class`Foundry`.TextDocumentAddin] for actions that are relevant to the document based on the current diagnostics.
- list_symbols()¶
- Returns:
a [class`Dex`.Future] that resolves to a [iface`Gio`.ListModel] of [class`Foundry`.Symbol].
- Return type:
Queries [class`Foundry`.SymbolProvider] for symbols that are relevant to the document.
- load_settings()¶
- Returns:
a [class`Dex`.Future] that resolves to a [class`Foundry`.TextSettings] or rejects with error.
- Return type:
Loads the settings for the document.
Text editing applications should bind the properties of the resulting [class`Foundry`.TextSettings] to their document’s text editor.
- save(operation)¶
- Parameters:
operation (
Foundry.OperationorNone) – an operation to update with progress- Return type:
- save_as(file, operation)¶
- Parameters:
file (
Gio.File) – a [iface`Gio`.File] of where to save the documentoperation (
Foundry.OperationorNone) – an operation to update with progress
- Returns:
a [class`Dex`.Future] that resolves to any value or rejects with error.
- Return type:
- watch_diagnostics()¶
- Returns:
a [class`Foundry`.OnTypeDiagnostics]
- Return type:
Watches the document for changes and updates diagnostics in the resulting [class`Foundry`.OnTypeDiagnostics] which is a [iface`Gio`.ListModel].
- when_changed()¶
- Returns:
a [class`Dex`.Future]
- Return type:
This function will resolve a new [class`Dex`.Future] when the underlying [iface`Foundry`.TextBuffer] has changed.
Use this to invalidate external resources that rely on the contents of the document buffer.
This notification is done after a short delay to avoid spurious events during rapid modification to the buffer.
If the document is dispoed, this future will reject with error.
Signal Details¶
- Foundry.TextDocument.signals.saved(text_document, file)¶
- Signal Name:
saved- Flags:
- Parameters:
text_document (
Foundry.TextDocument) – The object which received the signalfile (
Gio.File) – a [iface`Gio`.File]
This signal is emitted after the document has been saved to file.
New in version 1.1.
Property Details¶
- Foundry.TextDocument.props.addins¶
- Name:
addins- Type:
- Default Value:
- Flags:
- Foundry.TextDocument.props.buffer¶
- Name:
buffer- Type:
- Default Value:
- Flags:
- Foundry.TextDocument.props.draft_id¶
- Name:
draft-id- Type:
- Default Value:
- Flags:
- Foundry.TextDocument.props.file¶
- Name:
file- Type:
- Default Value:
- Flags: