VS Code / Using it
Shortcuts in VS Code
The keys Penstock binds in the editor and the project tree, including the AI chat and Focus canvas, and how undo, redo and rename work.
In the editor
| Key | Command | What it does |
|---|---|---|
| Ctrl+Alt+, Cmd+Alt+, on a Mac | Penstock: Find action | Open the editor's searchable list of every action. |
| Ctrl+Alt+' Cmd+Alt+' on a Mac | Sidebar | Show or hide the sidebar of the editor. |
| Ctrl+Alt+\ Cmd+Alt+\ on a Mac | AI chat | Open the Chat tab of the sidebar, or return to the tab you had before. Only there while the AI chat is on. See AI chat. |
| Ctrl+Alt+Shift+M Cmd+Alt+Shift+M on a Mac | Focus canvas | Hide the sidebar of the editor and show only the canvas. Press it again to bring it back. Never saved: a new window shows the sidebar as you left it. |
| Ctrl+Shift+; Cmd+Shift+; on a Mac | Trace paths | The Trace paths action of the editor. |
| Ctrl+Shift+C Cmd+Shift+C on a Mac | Export… | Export the diagram as a picture. |
Every one of these is bound only while a Penstock editor has the focus. Ctrl+Shift+C is also the terminal's copy key on Windows and Linux, and this keeps it that way. Outside a Penstock editor, VS Code's own key applies.
In the diagram
The keys of the canvas itself are the editor's own, the same in every tool: undo and redo, cut, copy and paste, Ctrl+D (Cmd+D on a Mac) to duplicate the selection, select all, find, zoom, Ctrl+0 to fit the diagram, and ? for the sheet that lists them all. Tab accepts and Esc dismisses a suggestion. See Editing a diagram.
In the Penstock view
| Key | Command | What it does |
|---|---|---|
| Shift+Alt+F12 | Find usages | Find usages of the selected node in code. Pro. |
| Ctrl+C Cmd+C on a Mac | Copy | Copy the ID of the selected node to the clipboard. |
| Ctrl+F12 Cmd+F12 on a Mac | Go to implementation | Open the code that implements the selected task. Pro. |
| Enter | Open | Open the diagram or code file for the node. |
These keys are bound while the Penstock view in the Activity Bar has focus.
Undo and redo
The text document is the only history of a diagram, and the diagram's own undo and redo keys and buttons ask VS Code to undo and redo. So VS Code's keys for Undo and Redo move the diagram, and so does Edit | Undo.
Any other action
Every action of the editor is a command named penstock.action. followed by the action, for example penstock.action.deploy. Bind a key to one in Keyboard Shortcuts: search for Penstock, or for the name the action has in the editor, such as Auto layout. Use the penstockEditorFocused condition to bind it only in the editor, as the editor keys above do.
In your code
Press F2 on a name that diagrams and code share (a job type, topic, bean, message, signal, process, decision, form or error) to rename it in both. Pro. Navigation commands use VS Code's standard keys: Go to Definition (F12) and Find All References (Shift+Alt+F12) reach the diagrams, and a click on a code lens opens the diagram. See Code links in VS Code.
Common problems
- A key does nothing in the diagram.
- The editor must have focus. Click an empty spot on the canvas. An action the diagram has switched off does nothing.
- Ctrl+Shift+C does not export.
- It is bound only in a Penstock editor. In any other panel VS Code's own binding applies.