PPocket Editor DOCUMENTATION
Plugins / POCKET EDITOR

Bundled plugin catalog

Every loadable plugin in the source tree is listed below. Helpers beginning with _ are not standalone plugins. Commands and service/event names are extracted from the Python syntax tree without executing plugins. Event lists show statically declared names, not every dynamic event.

Plugins

Python files in pocket_editor_plugins/ define register(api). Plugin IDs are filename stems. Plugins load in filename order and repeated Load New Plugins does not register them twice.

The API supports commands, text access/replacement, paths, events, services, and discovery. api.list_services() returns qualified service names. api.on_cleanup(callback) registers cleanup for failed registration or editor exit. Event callbacks and service calls execute on the GUI thread. Event payload key source is reserved. Plugins are trusted Python code; plugins that access private editor internals must register cleanup for their own side effects.

The terminal is an output-only shell runner. Its output queue and retained text are bounded; retained text is limited to 200,000 characters and individual long lines retain their last 8,192 characters. Stop and application exit terminate the process group on POSIX. Deliberately detached processes are outside this guarantee. Windows process-tree handling needs platform verification.

Regex searches run in a disposable Python process with a 0.5-second execution timeout and a 100,000-match limit. A search may briefly pause the GUI while that bounded operation completes. Syntax highlighting pauses above 300,000 document characters.

Plugin Builder

Use Extensions → Plugin Builder… to preview, create, and load a command, text transform, tool window, or event/service plugin. Existing plugin files are protected from overwriting. See Plugin development and API reference for the tutorial, templates, events, services, cleanup, testing, and reload workflow.

Plugin Manager

Choose Extensions → Plugin Manager…, Settings → Plugin Manager…, or find it through Ctrl+Shift+P. Search by plugin ID or status, select a plugin, and inspect its path, registered commands, subscribed events, services, and latest loading or command error. Open source opens the file in an editor tab. Refresh rescans installed plugins; Load new plugins retries failed registrations and loads newly enabled plugins that have not already loaded.

Enable/Disable persists startup preferences in disabled_plugins in the editor settings. Disabling a loaded plugin takes effect after restarting; it does not remove running callbacks or existing menu commands mid-session. Enabling an unloaded plugin allows Load new plugins to load it. Edited plugins that already loaded require a restart. Failed settings writes roll back the requested toggle. Runtime errors remain visible until restart; successful registration clears a previous loading error.

In --safe-mode, use Settings → Plugin Manager… to disable a broken plugin, then restart normally. Loading remains disabled while in safe mode. The manager reports the current process's registered events and services, not a dependency manifest or every event a plugin might emit. Helpers beginning with _ are excluded.

Run python3 -B -m unittest -v test_plugin_manager for startup preferences, safe mode, plugin communication inspection, error retry, and settings-failure checks.

Inline syntax diagnostics

The syntax_diagnostics plugin checks saved Python (.py, .pyw, .pyi) and JSON (.json) filenames after a 450 ms typing pause. Checks use the current unsaved buffer, run in a background worker, and never execute user code. The first syntax error gets a red underline and a clickable line/column message below the editor. Fixing the error clears the marker. Results from a changed or switched document are discarded.

Search the palette for Check Syntax, Go to Syntax Error, or Toggle Automatic Syntax Checks. Manual checks remain available when automatic checks are off; that toggle lasts for the current session. Untitled and unsupported filenames are not checked automatically. Checks skip files above 200,000 characters. Python uses the running interpreter's compiler; JSON uses Python's built-in JSON decoder. These are syntax checks, not type checking, undefined-variable analysis, or project-wide diagnostics. Undo, saving, and file contents are unaffected by checking.

Other plugins can request an asynchronous check through api.call_service("syntax_diagnostics.check"), inspect api.call_service("syntax_diagnostics.get_status"), and subscribe with api.on("syntax_diagnostics.updated", callback). The completion event contains source, path (string or None), and result with a status/message and line/column for syntax errors. The check service queues work and returns None. Disable the plugin through Plugin Manager if needed.

Choose Extensions → Load New Plugins or restart to enable it. Verify with python3 -B -m unittest -v test_syntax_diagnostics.

The Extensions toolbar dropdown groups commands by plugin to keep the menu compact. Add to toolbar uses the same plugin groups and shared checkmarks as the menubar. Plugins with more than 18 commands continue under More… rather than producing an oversized menu. Search Commands opens the command palette for direct access to every command. The menubar's Plugins menu remains available.

ai_assistant

Bundled free-model AI Chat and AI Code, explicit attachments, Ask/Team workflows, history, reply caps, and provider cooldowns. Uses the packaged tools/ai scripts, with a legacy sibling fallback.

How to use: Configure provider credentials through /keys in tools/ai/chat_ai.py or tools/ai/code_ai.py, open AI Chat or AI Code, and Refresh models. Select Ask or Team, explicitly attach files/current document, then Send. Stop cancels the local process. Use Reply tokens only when you intend to raise the requested cap; provider limits still apply.

Commands: Copy conversation, Reset context, Refresh models, Help & limits, AI Chat…, AI Code….

View source

code_theme

Dark, Light, Dracula, and Solarized Dark document themes with bounded syntax highlighting. Theme choices do not replace editor chrome.

How to use: Open Code Theme, choose a color scheme and language, and close the dialog. Auto selects highlighting from the filename extension. Highlighting stops above 300,000 characters; text remains editable.

Commands: Code Theme.

Services: code_theme.refresh.

Subscribed events: document_switched, document_changed, document_formatted.

View source

editor_commands

Fourteen everyday line-editing, tab-navigation, clipboard-path, and zoom commands. Line changes support Undo; tab closing checks unsaved edits.

How to use: Place the cursor on a line or select several lines, then invoke a line command from the palette. Selection ending at the next line’s column zero excludes that next line. Go to Line asks for a valid line number. Copy Path needs a saved filename. Zoom preferences persist.

Commands: Duplicate Line / Selection, Move Lines Up, Move Lines Down, Delete Lines, Trim Trailing Whitespace, Go to Line…, Copy File Path, Copy Folder Path, Next Tab, Previous Tab, Close Other Tabs, Zoom In, Zoom Out, Reset Zoom.

View source

git_project

Independent Git tools for any project: automatic init, shared repository service, local Git settings, clone, origin, status, commits, pull, and push. Optional Explorer integration.

How to use: Open Git Project or use Explorer Actions. Browse selects a folder and initializes Git if absent; Set Git Folder prepares a typed path. The repository root is available through ensure_repository/get_repository services. Clone downloads a repository. Set Origin configures its remote. Save files, Refresh, select changes, and Commit Selected. Push publishes; Pull only fast-forwards and requires closed project tabs. Settings edits repository-local author identity, origin, line endings, executable-bit tracking, and commit signing; blank/Inherit uses inherited defaults.

Commands: Git Project.

Services: git_project.open_project, git_project.ensure_repository, git_project.get_repository, git_project.get_project.

Published events: git_project.repository_changed, project_changed.

View source

my_ai_example

Independent customizable AI tool with Responses/Chat Completions, provider settings, model discovery, explicit file attachments, and local request limits.

How to use: Open My AI Example and click Settings. Select a preset/API format, enter an API key if required, refresh models or type an exact model ID, and set limits. Use + Files for up to four UTF-8 snapshots and the active-tab checkbox for unsaved editor context. Enter sends, Shift+Enter adds a line, and Open reply creates a new unsaved document.

Commands: My AI Example….

Services: my_ai_example.get_status.

Published events: my_ai_example.reply.

View source

php_completion

PHP completion through the local Intelephense language server, with snippets, project/library configuration, and stale-result protection.

How to use: Choose Open Project, open a PHP-family file, and press Ctrl+Space or type an identifier. Navigate suggestions with arrows, accept with Enter/Tab, and dismiss with Escape. Settings controls automatic delay, limits, PHP version, and additional library folders. Use Reindex PHP Project after external filesystem changes.

Commands: PHP Completion, PHP Completion Settings, PHP Completion Help, Reindex PHP Project.

Services: php_completion.complete, php_completion.status.

Subscribed events: document_changed, document_saved, project_changed.

View source

php_formatter

Prettier PHP formatting of the active buffer with one-step Undo; does not save the document to disk.

How to use: Open a PHP-family document, invoke Format PHP, review the buffer, and Save separately. Use PHP Format Settings for print width and target version. Missing local Node dependencies or invalid syntax leave the text unchanged. Undo reverts a formatting change.

Commands: Format PHP, PHP Format Settings.

Services: php_formatter.format, php_formatter.busy.

Published events: document_formatted.

View source

plugin_builder

Preview and create a simple command, text transform, tool window, or event/service plugin. Exclusive creation protects existing files.

How to use: Choose a unique lowercase plugin ID, command label, description, and template. Inspect Code preview and Documentation, then Create & load. A source tab opens for editing. Restart after changing an already-loaded plugin. The Plugin communication page lists loaded IDs/services; Refresh services updates it.

Commands: Plugin Builder….

View source

project_explorer

Project tree with Open/Save/Load project controls, file operations, and launchers for independent Git and hosted teamwork.

How to use: Choose Open Project and select a folder. Expand the tree and double-click a file, or press Enter. Use Actions or the context menu for New File, New Folder, Rename, Delete, and Refresh. Rename is also available through F2. File operations require explicit UI actions and retain unsaved-file protection.

Commands: Open Project Folder…, Load Project…, Save Project, Save Project As…, Git Project…, Team Project…, Open File, New File…, New Folder…, Rename…, Delete…, Refresh, Project Explorer, Open Project, Load Project, Save Project As.

Services: project_explorer.get_project, project_explorer.open_project.

Subscribed events: project_changed.

Published events: project_changed, document_changed.

View source

project_terminal

Output-only system-shell runner with stop controls, per-project commands, ANSI rendering, semantic categories, and portable appearance preferences.

How to use: Set a working directory and command, then Run. Stop terminates the process group where supported. Save Project Command remembers the command for that directory. Settings configures presets, ANSI colors, categories, font/encoding, and force-color. This runner has no interactive input.

Commands: Project Terminal, Project Terminal Settings….

Services: project_terminal.show, project_terminal.get_settings.

Published events: terminal_settings_changed, command_finished.

View source

python_formatter

Python formatting using optional Black, with settings and Undo. Black must be installed in the editor’s interpreter.

How to use: Open a Python document and choose Format Python. Review the buffer, use Undo if needed, and Save separately. Python Format Settings selects a line length from 40 to 200. Black can also use project configuration and fmt: off regions. A missing Black dependency produces an error rather than silently changing tools.

Commands: Format Python, Python Format Settings.

Services: python_formatter.format.

Published events: document_formatted.

View source

rich_text

Text styles and formatted .pocket copies. Plain-text Save does not preserve formatting. Text Undo is available; formatting Undo is not implemented.

How to use: Select text before applying Bold, Italic, Underline, Strikeout, font, size, text color, or highlighting. Paragraph alignment affects the relevant paragraphs. Clear Formatting removes rich tags from the selection. Save Formatted Copy creates a .pocket file; Open Formatted loads one into a new tab. Formatting changes require a formatted copy to preserve them.

Commands: Rich Text.

View source

search_replace

Find and replace with previous/next navigation, regex options, and bounded regex execution in a disposable process.

How to use: Open Search & Replace, enter the search and optional replacement, choose case/regex options, then use Next or Previous. Replace selects the next match before replacing if no matching active result is selected; Replace All works on the active document. Regex replacements support capture references. Invalid expressions and bounded-search failures are shown without replacing the document.

Commands: Search & Replace.

Published events: document_changed.

View source

syntax_diagnostics

Non-executing Python/JSON syntax checks in a worker, error markers, jump-to-error, and a status/check service.

How to use: Save or open a Python/JSON filename, then edit. After the debounce pause, the first syntax error is underlined and its message appears below the editor. Click the message or invoke Go to Syntax Error. Check Syntax runs manually; Toggle Automatic Syntax Checks affects this session. Checks skip buffers over 200,000 characters and never execute source.

Commands: Check Syntax, Go to Syntax Error, Toggle Automatic Syntax Checks.

Services: syntax_diagnostics.get_status, syntax_diagnostics.check.

Subscribed events: document_changed, document_switched, document_saved.

Published events: syntax_diagnostics.updated.

View source

team_project

Host/client project copies, individual keys, portable client invitations, modern group chat, and audio/video/file exchange.

How to use: Choose Host a project or Join as client. Host mode shows its actual listen port and suggests a LAN address. Easy Internet Setup detects OS/CPU, installs a checksum-verified user-local cloudflared, and starts a temporary HTTPS relay. Only a verified relay URL is filled into invitations. It also exports setup commands/scripts. Client mode loads an invitation; no client listening port is needed. Details shows local and peer endpoints; the host client list shows last observed IPs/source ports. Under Project Copies, generate a named client key and export a .team-invite using a reachable server URL. Detect My Public IP is at the top for both roles before connecting and uses HTTPS fallback services with visible DNS/network errors; Use HTTPS IP sets the invitation address only after an explicit click. HTTPS and actual inbound reachability must be configured separately. The client loads that invitation, chooses a local copy folder, and clicks Join Team. Use Group Chat and Shared Files to communicate, and Project Copies to pull or send saved file changes.

Commands: Team Project.

Services: team_project.open_project.

View source

text_formatting

Preview transformations for selection or document: case changes, whitespace cleanup, indentation, sorting, and duplicate-line removal.

How to use: Select a region or leave no selection to target the whole document. Open Text Formatting, choose an operation and indentation width, and review the preview. Apply Formatting performs an undoable change. If the document or selected range changed while the dialog was open, reopen the formatter instead of applying stale results.

Commands: Text Formatting.

View source

word_count

Counts words in the selected document and displays the result.

How to use: Choose Count words to count whitespace-separated words in the whole active document, including unsaved edits. A text selection does not restrict this count.

Commands: Count words.

View source

Created by Somi Douth · Built with Python and Tkinter