VS Code companion (vscode/) #1
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Moved from thatrichan/revue#69.
A VS Code extension, Revue Companion, doing what the JetBrains plugin (
jetbrains/) does: the repository's pull requests from Revue inside the editor, and the way back, with Revue opening a pull request in the VS Code window that has its branch.It should also run in the editors built on VS Code (VSCodium, Cursor, Windsurf…), so it's published on both the VS Code Marketplace and Open VSX.
Features (as in the JetBrains plugin)
revue --pull-request <folder>.revue --pullswith--show, drafts, search, more pages), in Revue's sections (This branch, To review, Mine, Others), favorites first. Selecting one opens its details in a webview: review, checks, conflicts, files, conversation, Slack threads, stack (revue --pull), with Open in Revue, Open in browser, Copy link, Switch to Branch, Create Worktree (--worktree), Fetch branch (--fetch-branch).--branch-pull,--pending), Open File in Pull Request at the cursor's line (LINK --file … --line …), Add Pending Comment on the selection (--comment), Go to Pull Request File (a quick pick of its files).revueCompanion.path(therevueexecutable; empty: PATH, then the install places the JetBrains plugin looks in), and what to do when Revue isn't running (once thatrichan/revue#66 lands: answer anyway, or offer to start it).It talks to Revue only through the
revuecommand (Revue'sdocs/command-line.md, "What editors can ask"), and checksrevue --version'seditor <N>line before using it, as the JetBrains plugin does. No tokens enter the editor.The way back: Revue reaching a running VS Code
JetBrains IDEs answer on their built-in server (
/api/revue-projects,/api/revue-open). VS Code has no such server, so:127.0.0.1on a free port, and writes<Revue's data folder>/companions/vscode-<pid>.json:{ "kind": "vscode", "app": "Visual Studio Code" | "Cursor" | …, "pid", "port", "token", "version" }. It removes the file on deactivation; Revue ignores a file whose pid isn't running or whose port refuses.GET /revue-projects(the window's workspace folders, each repository's root, branch and remotes, and whether the window is focused) andGET /revue-open?path=&repo=&branch=&file=&line=(focus this window if it has the branch, elsevscode.openFolderin a new window, then the file at the line). Each request carries thetokenfrom the file, so no other local program can drive the editor.companionsmodule that reads the folder alongside the JetBrains port scan, giving the editor chooser (thatrichan/revue#68) one list of running companions of every kind. The registration format is shared with the Neovim companion.Where it lives
vscode/in this repository (TypeScript,@vscode/vsceandovsxfor packaging and publishing): build, test (@vscode/test-electronagainst a fakerevuethat prints fixture JSON), package (.vsix), and arelease-vscodeworkflow started by hand (patch, minor, major), likerelease-jetbrains. Publisher:cleangamedev(display name Clean Gamedev, the JetBrains plugin's vendor), the same ID as the Open VSX namespace, so the extension iscleangamedev.revue-companion.Publishing
vscode-vX.Y.Z, builds the.vsixonce, attaches it to the Forgejo release, and publishes it to Open VSX withovsx publish(Forgejo secretOPEN_VSX_TOKEN, passed asOVSX_PAT)..vsixfrom the release, at https://marketplace.visualstudio.com/manage →cleangamedev→ Update. Automated publishing isn't available without Azure: Azure DevOps personal access tokens for the Marketplace are global PATs, retired on 2026-12-01, and a new Azure DevOps organization needs an Azure subscription. The release's summary says the upload is left to do.vsce publish --azure-credentialwith an Entra ID service principal (needs a Pay-As-You-Go Azure subscription, no cost; secretsAZURE_TENANT_ID,AZURE_CLIENT_ID,AZURE_CLIENT_SECRET), orvsce publish --oidctrusted publishing from a GitHub Actions mirror (GitHub only; could share a mirror with #5).Plan
companionsmodule in Revue, with tests (a fake registration file, a stale one, a wrong token).revue,--version, Open or Create Pull Request, the status bar item./revue-open, then thatrichan/revue#68 choosing it.docs/editors.mdgets a VS Code section; publishing as above.revuecommand, so Open in editor can reach them #80The skeleton is in (merged in
cbec851):vscode/: TypeScript bundled with esbuild,cleangamedev.revue-companion0.1.0.revue(revueCompanion.path, PATH, then the JetBrains plugin's install places), gating oneditor N,--headlessfromeditor 2.#7 Open, Draft, Merged, Closed, or Create Pull Request).revueCompanion.whenNotRunning(answer, offer, start), as in JetBrains.task vscode:unit-test,vscode:test(in a real VS Code against the JetBrains fakerevue;VSCODE_EXECUTABLEfor an installed VS Code or VSCodium),vscode:package(.vsix).26 unit tests and 6 editor tests pass (VSCodium 1.143). Next: the Pull Requests view. The way back needs thatrichan/revue#80 first.
The Pull Requests view is in (merged in
2165e27):revuegot Slack threads and a stack for #7 / #13.55 unit and 12 editor tests pass (VSCodium 1.143, against the fake). Next: the UI walk with pictures, then the editor phase (changes, Open File in Pull Request, Add Pending Comment).
The editor phase is in (merged in
abeec26):--sides, editor 3): stripes, peek, next / previous change. Shown only while the checkout is at the pull request's head, as in JetBrains.task vscode:ui-test: walks the extension in VS Code, light and dark, a picture of each step invscode/build/ui-screenshots/. Its first pictures caught three layout bugs in the Files tab and the page, fixed.65 unit and 20 editor tests pass (VSCodium 1.143). To check: that the second quick diff draws in VS Code 1.95 (the oldest supported), Cursor and Windsurf, and whether the empty "Revue Pull Request" row it adds in Source Control is acceptable. Next: Review in IDE.
The way back is in (merged in
9b356c8), against thatrichan/revue#80 (editor 9):editor 9or later, each window listens on 127.0.0.1 with a fresh token, registers withrevue --companion vscode … --app <editor name>, and takes it back (--companion-gone) on deactivation.GET /revue-projects: this window's workspace folders and their repositories, and whether it has (or last had) the focus.GET /revue-open: the window with the repository on that branch focuses and opens the file at the line; otherwise the folder opens in a new window, which opens the file once it starts. No or a wrongX-Revue-Tokengets 401.revueanswerseditor 9and checks registrations as the contract says.85 unit and 27 editor tests pass (7 for the way back). To check with a real Revue on a desktop: that Open in editor picks VS Code, that
workbench.action.focusWindowbrings the window forward (window managers may refuse), and Cursor, Windsurf and VS Code 1.95.Review in IDE, the Revue account and the release are in (merged in
4c42dc0):--sides); conversations and drafts as comment threads on their lines — reply, resolve / reopen, edit, delete, reactions (editor 8),@completion frommentionable, a new comment from the gutter's +, a suggestion's Apply to Your Copy.--submit-options(Write / Preview summary with@, what goes with it, resolve yours, Notify in Slack), verdicts with why they're disabled..forgejo/workflows/release-vscode.yml(by hand, patch / minor / major): tagsvscode-vX.Y.Z, builds the .vsix once, attaches it to the Forgejo release and publishes to Open VSX (secretOPEN_VSX_TOKEN); the Marketplace upload stays by hand.vscode/README.mdis the stores' page.117 unit, 33 editor and 14 UI-walk steps pass in VSCodium. Left: the first Open VSX / Marketplace listing and the
OPEN_VSX_TOKENsecret; checking against a real Revue, and in VS Code 1.95, Cursor and Windsurf.Released as vscode 0.1.0 on Open VSX and the Forgejo release; Revue 0.44 has what it needs (editor 8 to 10). CI now runs its tests on every push (
vscode.yml). What is left (the Marketplace upload, trying it in Cursor, Windsurf and VS Code 1.95 against a real Revue) is in #9.