Revue Companion for VS Code #69
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?
A VS Code extension, Revue Companion, doing what the JetBrains plugin (jetbrains-plugins/revue-companion) 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 #66 lands: answer anyway, or offer to start it).It talks to Revue only through the
revuecommand (docs/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 (
jetbrains::PORTS,/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 #68's chooser one list of running companions of every kind.This registration scheme is shared with the Neovim plugin, which uses it the same way.
Where it lives
A new repository,
vscode-revue-companion(TypeScript,@vscode/vsceandovsxfor publishing), with a Taskfile like Revue's: build, test (@vscode/test-electronagainst a fakerevuethat prints fixture JSON), package (.vsix), and a release workflow started by hand (patch, minor, major) that publishes to both marketplaces. Publisher ID to choose (cleangame?).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 #68 choosing it.docs/editors.mdgets a VS Code section; publishing to both marketplaces.Related: #68 (choosing the editor with a companion running), #66 (answers without the app running).
Moved to thatrichan/revue-companion#1, where the companions live now (
vscode/, next tojetbrains/). The Revue side of it (thecompanionsregistration folder and the editor chooser) stays here, in #68.