Skip to content

Features

Feature Thonny 5 integration
.pseudo / .algo One Pseudocode language, extensions sourced from the core
Run / F5 / Ctrl+R / green triangle For Pseudocode files, routes to the same !pseudo <file> localized CLI path; .py keeps normal Thonny Run
Syntax highlighting Shared Pygments roles mapped to Python-equivalent native Thonny tags; Operator.Word uses the native keyword tag, so localized logical/membership words are colored consistently; active theme chooses colors
Diagnostics Live 300 ms LSP diagnostics; editor ranges and Diagnostics-tab lines use red/orange/blue severity accents; Lxx markers jump to the exact source line/column; Diagnostics is selected automatically when a Pseudocode editor becomes active
Completion Native Thonny popup opens automatically while typing Pseudocode; Ctrl+Space remains explicit fallback. Rapid typing is debounced, then candidates are ranked exact → prefix → contains
i18n snippets Canonical snippets from the core, filtered against the typed prefix and linked to the exact shared documentation card; Thonny keeps only the popup/insertion adaptation
Hover Timed LSP pointer hover with localized/exhaustive keyword/type/builtin help
Signature help Thonny calltip UI fed by textDocument/signatureHelp
Ctrl+click Language syntax opens Documentation; user symbols use textDocument/definition
References / rename Pseudocode Navigation menu backed by LSP semantic references
Formatting Pseudocode menu + Ctrl+Shift+I (also Ctrl+Shift+F)
Language Read-only drop-down of all 14 supported language names + ISO 639-1 codes; Thonny menu language remains a separate UI concern
Conversion Pseudocode → Python and Python → Pseudocode save the generated file and immediately open it in a new Thonny tab
Step-by-step execution Shared pseudocode-tutor/v2 model: source line, first/previous/play/pause/next/last, scopes/variables with old → new changes, call stack, progressive output/input state and synchronized algorigram; visible labels and boolean/null values follow the detected Pseudocode language while typed protocol values stay native
Flowcharts Static Algorigramme tab: pseudocode/flowchart whole-program/symbol scope with localized display_label text + asynchronous scrollable PNG. Shared input/output nodes are parallelograms, loop tests keep their localized head, and rendered connectors use orthogonal routing. Tutor: static graph embedded in pseudocode-tutor/v2, drawn once on Tk Canvas and highlighted by stable node/edge IDs
Informations Thonny/Python/core/LSP/lexer versions plus LSP state and project information
Documentation Core-generated catalogue in the source language with live weighted search and concrete examples; menu/tab label follows Thonny UI language
Pseudocode UI context Pseudocode menu + Diagnostics → Exécution pas à pas → Documentation → Algorigramme → Informations are enabled only for an active .pseudo / .algo editor; normal File → Open remains available everywhere
Server lifecycle automatic document resynchronization, stale-diagnostic filtering, coalesced recovery and transport-generation guards; automatic LSP process/transport recovery reopens tracked documents; manual restart remains only as a fallback

Diagnostics and hover priority

When the pointer is over a range that has a diagnostic, Thonny shows the localized diagnostic first. The diagnostic message is always shown first. If the range is also a documented language fragment, the tooltip additionally indicates Ctrl+click → Documentation. This prevents an invalid Lis "Allo" statement from hiding its real error while still giving direct access to the relevant syntax help.

Snippets in Thonny 5

The adapter advertises snippetSupport = false because Thonny 5 does not implement LSP tab-stop snippet placeholders. The language server therefore converts the same canonical localized snippet to safe plain text. Snippets are not a separate Thonny-only catalogue. Thonny's own automatic completion path normally ignores non-Python editors, so this plugin only supplies the missing IDE-specific trigger: a 90 ms debounce calls the existing Thonny popup for Pseudocode, while the candidate data and documentation remain owned by the core/LSP.

Language separation

The Pseudocode source language controls keywords, diagnostics, runtime errors, snippets and pedagogical help. The Thonny UI language controls the plugin's Pseudocode menu/submenus. A Spanish Pseudocode file opened in a French Thonny UI therefore keeps Spanish language diagnostics while the menu remains French.

Language-server recovery

The language server is intended to stay alive for the whole Thonny session. A restart is not part of normal editing. The adapter keeps full-document versions synchronized and ignores late diagnostics from older versions. If the pseudo-lsp process exits unexpectedly, initialization fails or the stdio transport breaks, the adapter automatically restarts it with short bounded backoff and sends fresh didOpen snapshots for every tracked .pseudo / .algo editor. The manual Restart language server command is retained for exceptional debugging/recovery only.

Tutor and custom-request transport

The Thonny frontend never traces the program itself. It requests pseudocode/tutor from pseudo-lsp and renders the returned core session in three columns: Source | État | Algorigramme. One-step advance and automatic Play are distinct controls with Pause and adjustable speed. Human-facing scope/event labels and rendered boolean/null values use the Pseudocode source language; canonical IDs and native JSON values are kept unchanged for synchronization. The Tutor session already embeds the static graph plus stable active node/edge IDs; Mermaid computes the layout once per scope/theme/settled width, then Thonny draws that exact SVG geometry on the native Canvas and only toggles changed IDs while stepping. Source highlighting, progressive output and variable values are likewise updated incrementally. The separate static Algorigramme tab uses pseudocode/flowchart for PNG preview/export. For compatibility with the shared LSP parameter normalizer, custom requests carry the active document URI both in standard textDocument.uri form and as a redundant top-level uri; the session layer also defensively re-imposes the current document URI before transmission.