Plugin API: Signals

About signals

When certain operations are performed by user in IDE, signals are sent to all plugins that have subscribed to them, informing about these operations. Functions that are connected to signals can receive signal parameters, some signals allow changing parameters and returning value. Scripts can subscribe to signal with Script.ConnectSignal function.

Note that some of the signals are executed very often and they have to be processed very quickly. Do not perform any CPU heavy or HDD input/output operations in functions subscribed to such signals.

Example

function OnInstalled() {
  alert("Thank you for installing this new and awesome plugin!");
}

Script.ConnectSignal("installed", &OnInstalled);

Signals reference

Signal Params Returns Description
installed () none or string Fired after plugin has been installed in Plugin Manager. Perform startup operations here.
Returning error message causes plugin installation to fail and the message is displayed to user.
uninstalled () none Fired just before plugin has been uninstalled.
ready () none Fired after IDE has finished startup initialization or plugin has been just enabled after disabling. Perform startup operations here.
exit () none Fired when plugin is ending due to IDE closing or plugin being disabled or uninstalled.
enabled () none Fired when plugin was disabled and is now enabled.
keypress (&key) none Fired when user pressed key in editor area. Key can be changed or set to empty string to disable the keypress.
keydown (&key) none Fired when user is pressing key in editor area. Key can be changed or set to empty string to disable the keypress. For low-level keyboard access only.
update_code_type (code_type) none Fired when code type may have changed (e.g. cursor moves from PHP code to HTML code).
auto_complete (code_type, auto_complete_type, strings, key, &allow, showimages) none Fired when auto-complete popup is about to appear. Use strings parameter with functions from AutoComplete object to manipulate the list. See examples.
auto_complete_insert (auto_complete_type, list_item_at_cursor, &code_string, &word_start_position, &word_length, &line_offset, &handled) none Fired when auto-complete item was selected. See examples.
show_hint (code_type, &hint, key, &allow) none Fired when code hint is about to appear.
click (Document) none Fired when editor area is clicked.
double_click (Document) none Fired when editor area is double-clicked.
cursor_move (Document) none Fired when cursor changes position in editor area.
modified (Document) none Fired when editor area is modified.
document_open (Document) none Fired when new document tab is opened.
document_before_save (Document) none Fired before saving.
document_after_save (Document) none Fired after saving.
document_close (Document) none Fired when document tab is being closed.
document_focus (Document) none Fired when document receives focus.
document_blur (Document) none Fired when document loses focus.