P4 WorkbenchP4 Workbench brings Perforce file history, code review, and workspace operations into VS Code. Select a line to trace its originating changelist, inspect a teammate’s shelf before unshelving it, or compare whole folders in a single editor. Install and connect
The extension uses the P4 configuration and tickets available in the command’s working directory. File commands use the selected file’s directory. The sidebar uses the connected client. The status bar shows its user, client, port and ticket state. Select it to sign in, refresh or switch workspaces. In a multi-root workspace, Connect or Switch Workspace changes the sidebar connection. Commands run in trusted workspaces. Upgrading from a previous VSIXVersion 0.5.1 uses the extension ID The earlier P4 Workbench 0.1.0 package used the same extension ID as 0.5.1. Installing 0.5.1 replaces that implementation. Review any custom Open a client from the Workspace HubRun P4 Workbench: Open Workspace Hub from the Command Palette, or expand Perforce Workspace Hub in Source Control after connecting. The hub runs Expand a client to search its accessible root and alternate roots for saved Only the expanded client is searched. Discovery includes nested folders and skips symbolic-link entries, Git metadata, Trace a change
Open Time-Lapse
Review and submitOpen Source Control and select the Perforce repository. Each pending changelist has a group, including empty numbered changes. Working files show edits (M), adds (A), deletes (D), and moves (R). Click an opened file to select it. Double-click, press Enter, or use its compare icon to open the native diff. Hold Cmd on macOS or Ctrl on Windows and Linux to select several files. Use the row’s Revert File… button to review and revert an opened file. The group menu’s Revert Opened Files in Changelist… lets you choose several files together. Revert checks for unsaved buffers, keeps rename pairs together and leaves shelved copies intact. The group menu includes Open Changelist Diff, Submit Changelist, and shelving actions for numbered changes. Use the repository menu to create a changelist or preview offline work. A Shelf label identifies a numbered changelist with shelved files even when it is collapsed. Its group menu offers Unshelve Entire Changelist… and Unshelve Selected Files…. Starting the latter from a shelf file preselects that path. Shelved files have an S badge. If a file is both open and shelved, each version has its own row. Select the shelf row to compare it with its depot base, or choose Compare Shelf with Working File from its context menu. The repository badge counts opened files. Select one or more opened files in Source Control and choose Move Selected Files to Changelist… to move them to the default changelist or one of your numbered pending changelists. Review the selected paths before applying. A rename moves as a pair, even if you selected only one side. Existing shelves and unsaved editor text stay in place. Choose Replace Shelved Files… on a changelist with a shelf to review what will enter, leave, or stay on the shelf. A file reopened in another changelist leaves the old shelf even if it is still on disk. Select a text file for a diff, then return to the review to confirm the replacement. Refresh the review if the saved files or shelf changed while it was open. When the default changelist contains files, type a description in the Perforce Source Control input and press Ctrl+Enter (Cmd+Enter on macOS) to submit the default changelist. Confirm the file list before submission. Numbered changelists use their own descriptions. Use Rename Changelist… to change only its description’s first line. The pencil opens its complete Perforce specification. The Changelist Order setting sorts numbered changes in ascending or descending order. New Changelist opens an empty form with the description placeholder selected. The named tab supports multiline descriptions, Files, Jobs and custom fields. Saving keeps the draft in VS Code’s local workspace storage. Apply Changes updates the server. A new form opens under the number Perforce assigns. Use Reload Changelist from Server to resolve a stale draft. Perforce Changelists groups submitted changes and shelves. Expand a changelist to see its files or compare a shelved file with the working copy. Find Changelists opens a searchable tab for submitted changes, pending changes, shelves and changelist numbers. Expand a result for its full description or open its diff and return to the same results. File selections for sync, reconcile and resolve also stay open with their filters and checkboxes when you switch tabs. To take part of a colleague’s shelf, expand its result in Find Changelists or right-click it under Perforce Changelists → Shelved and choose Unshelve Selected Files…. Choose your destination changelist, check the paths you need, and review the Perforce preview. Starting from a file in the shelf preselects it. A rename includes both paths. Use Unshelve Entire Changelist… when you also want the shelf’s stream specification. Choose Open Changelist Details from a changelist’s context menu for the full description, linked jobs, filterable file table or review URL. Set Code Review URL to copy links to your team’s P4 Code Review server. Work with branch mappingsIn Source Control → Perforce Workspace → Branch mappings, use New Branch Mapping to start a specification, or right-click an existing mapping and choose Duplicate Branch Mapping. Review the depot paths in the native text editor, then run Apply Edited Specification to save the mapping to Perforce. Expand a mapping and choose Forward to follow the view from left to right, or Reverse to go from right to left. Each direction has two views.
To work on a previewed file, right-click it and choose Open for Integration in Changelist. Select a numbered pending changelist and confirm the file. The action opens the target at the reviewed source revision. Use the resolve preview for any pending merges, then review and submit the changelist when ready. If the client view excludes a target, the preview shows Perforce’s diagnostic. Branch integration · Outstanding changelists Share a Perforce selection with an agentSelect lines in a tracked working file or a submitted revision, then run Pin Perforce Review Context for Chat. For example, while reviewing a working file with unsaved edits, pin the selection and ask, “Which lines came from submitted changelists, and which lines are local?” The pin records the displayed revision and the originating changelist for each range, up to 100 selected lines. Larger selections report how many lines were included. In Branch mappings → Preview integration, right-click a file to pin its mapping, direction, action, source revision and target. Select P4 review context in the status bar to inspect the exact JSON. In a compatible VS Code chat, reference Changing focus keeps the pin. Pinning again replaces it. Clear Pinned Review Context, reconnecting, or closing the window clears it. Manage a workspace
P4 Workbench has no telemetry or hosted service. Revision text and changelist metadata are read through the configured P4 client. Publishing a changelist or shelf sends the selected work to your Perforce server. Offline work and settingsReconcile Entire Perforce Workspace… in the Source Control repository menu scans the connected client’s mappings, including sibling directories when the connection starts in a subfolder. Preview Reconcile Offline Work… uses the connected directory or selected path. Review the scope, checked files and actions before applying. File automation is opt-in. In Open P4 Workbench Settings, enable checkout on save, marking new files for add or marking removed files for delete independently. Creation and deletion follow VS Code file operations. Use reconcile to collect external filesystem changes. Inspect Effective P4 Workbench Settings… shows each setting’s value and whether it came from the selected folder, workspace, user or default settings. Executable paths belong in user or remote-machine settings. DevelopmentUse Node.js 24 or later.
Press F5 to launch an Extension Development Host. To run the integration suite, put Release automationPush a stable tag of the form To check an existing tag, open Actions → Release extension → Run workflow, select One-time publisher setupBoth registries exchange the workflow’s GitHub identity for short-lived credentials. Use repository owner
CreditsThe Workspace Hub uses a native tree so its rows follow the workbench theme and keyboard navigation. Each client shows its name and root, following VS Code’s Recent workspaces. Changelist search and specification drafts stay in editor tabs so you can inspect a diff and return to your place, as in VS Code’s Search Editor. Matt Crouch’s Perforce for VS Code continued Stef Levesque’s original extension. Its changelist specification editor inspired P4 Workbench’s named form tabs, description selection and explicit Apply action. P4 Workbench is an independent implementation. The P4V release notes and P4 command reference inform the workflows. |