Each extension must implement a ed_ext_init() callout, executed at application loading.

Optionally, feature callouts ed_ext_xxx() can be provided, with “xxx” the name of the feature.

Currently supported callouts:

ed_ext_init

Intialize the extension.

ed_ext_init(app: EdApp) -> None

Called at application startup phase. Can be used to detect settings, setup keyboard shortcuts, load custom CSS…

It’s fine to let it empty.

Warning! If an exception is raised at init, the extension will not be registered.

ed_ext_get_commands

Query commands to be added to the command-bar or menu.

ed_ext_get_commands(app: EdApp) -> dict[str, tuple[Callable[[EdWorkbench, EdBaseDocument|None, str], bool], str, bool|None, list[str]]]

Called at application startup phase (for generating the extensions menu) and when opening a workbench window (for populating the command-bar).

ed_ext_get_completion

Query additional source completion providers.

ed_ext_get_completion() -> tuple[GtkSource.CompletionProvider|GtkSource.HoverProvider, list[str]]

Called when opening a document that supports completion.

ed_ext_notif_wbench_opened

Called when opening a new window, before opening documents or project.

ed_ext_notif_wbench_opened(wbench: EdWorkbench) -> None

ed_ext_notif_wbench_saveall

Called when the saveall action is triggered, after saving documents.

ed_ext_notif_wbench_saveall(wbench: EdWorkbench) -> None

Can be used to save additional data unrelated to documents, or to handle documents that could not have been saved.

ed_ext_notif_wbench_closed

Called when closing a window, before freeing documents.

ed_ext_notif_wbench_closed(wbench: EdWorkbench) -> None

ed_ext_notif_project_loaded

Called when a project is loaded.

ed_ext_notif_project_loaded(wbench: EdWorkbench, project: EdProject|None) -> None

Can be used to update project-specific UI elements, like completions for the command-bar.

ed_ext_notif_notebook_added

Called when a notebook (i.e. tabs group) is added.

ed_ext_notif_notebook_added(wbench: EdWorkbench, notebook: EdNotebook) -> None

ed_ext_notif_notebook_removed

Called when a notebook (i.e. tabs group) is removed.

ed_ext_notif_notebook_removed(wbench: EdWorkbench, notebook: EdNotebook) -> None

At this point the notebook is already empty, its documents were either closed or moved to other notebooks.

ed_ext_notif_doc_added

Called when a document tab is added.

ed_ext_notif_doc_added(wbench: EdWorkbench, doc: EdBaseDocument) -> None

The actual document content may not have be loaded at this point.

ed_ext_notif_doc_loaded

Called when a document loaded its content from disk.

ed_ext_notif_doc_loaded(doc: EdBaseDocument) -> None

Can be used to restore states or detect document properties.

ed_ext_notif_doc_symbols

Called when a document reloaded its symbols, before updating them in the sidebar.

ed_ext_notif_doc_symbols(doc: EdBaseDocument) -> None

Can be used to modify the symbols list.

ed_ext_notif_doc_save

Called when a document is going to be saved to disk.

ed_ext_notif_doc_save(doc: EdBaseDocument, gfile: Gio.File) -> None

Can be used for formatting contents before being saved.

ed_ext_notif_doc_closed

Called when a document tab is closed.

ed_ext_notif_doc_closed(wbench: EdWorkbench, doc: EdBaseDocument) -> None

This is not called when closing the whole workbench, rely on ed_ext_notif_wbench_closed instead.