Revue Companion for VS Code #69

Closed
opened 2026-11-12 01:48:16 +01:00 by thatrichan · 1 comment
Owner

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: Open or Create Pull Request (Command Palette, Source Control title bar, status bar item): opens the current branch's pull request in Revue, or its New pull request page; revue --pull-request <folder>.
  • A Pull Requests view in its own activity bar container: the repository's open pull requests as Revue sees them (revue --pulls with --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).
  • In the editor: the branch's pull request's changes and pending comments marked in the gutter (--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).
  • Status bar: the branch's pull request number and state, a click opens it.
  • Settings: revueCompanion.path (the revue executable; 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).
  • Several Git repositories in a workspace: a picker, as the JetBrains tool window has.

It talks to Revue only through the revue command (docs/command-line.md, "What editors can ask"), and checks revue --version's editor <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:

  • The extension registers itself: on activation it listens on 127.0.0.1 on 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.
  • The same two requests as the JetBrains plugin: GET /revue-projects (the window's workspace folders, each repository's root, branch and remotes, and whether the window is focused) and GET /revue-open?path=&repo=&branch=&file=&line= (focus this window if it has the branch, else vscode.openFolder in a new window, then the file at the line). Each request carries the token from the file, so no other local program can drive the editor.
  • One server per window (every VS Code window is its own extension host), so Revue picks the window, as with JetBrains.
  • In Revue: a companions module 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/vsce and ovsx for publishing), with a Taskfile like Revue's: build, test (@vscode/test-electron against a fake revue that 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

  1. The registration folder and companions module in Revue, with tests (a fake registration file, a stale one, a wrong token).
  2. The extension's skeleton: finding revue, --version, Open or Create Pull Request, the status bar item.
  3. The Pull Requests view and the details webview.
  4. Editor markers, Open File in Pull Request, Add Pending Comment, Go to Pull Request File.
  5. The local server and /revue-open, then #68 choosing it.
  6. Docs: docs/editors.md gets a VS Code section; publishing to both marketplaces.

Related: #68 (choosing the editor with a companion running), #66 (answers without the app running).

A VS Code extension, **Revue Companion**, doing what the JetBrains plugin ([jetbrains-plugins/revue-companion](https://forgejo.cleangame.dev/thatrichan/jetbrains-plugins/src/branch/main/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: Open or Create Pull Request** (Command Palette, Source Control title bar, status bar item): opens the current branch's pull request in Revue, or its New pull request page; `revue --pull-request <folder>`. - **A Pull Requests view** in its own activity bar container: the repository's open pull requests as Revue sees them (`revue --pulls` with `--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`). - **In the editor:** the branch's pull request's changes and pending comments marked in the gutter (`--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). - **Status bar:** the branch's pull request number and state, a click opens it. - **Settings:** `revueCompanion.path` (the `revue` executable; 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). - Several Git repositories in a workspace: a picker, as the JetBrains tool window has. It talks to Revue only through the `revue` command (`docs/command-line.md`, "What editors can ask"), and checks `revue --version`'s `editor <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: - **The extension registers itself:** on activation it listens on `127.0.0.1` on 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. - **The same two requests** as the JetBrains plugin: `GET /revue-projects` (the window's workspace folders, each repository's root, branch and remotes, and whether the window is focused) and `GET /revue-open?path=&repo=&branch=&file=&line=` (focus this window if it has the branch, else `vscode.openFolder` in a new window, then the file at the line). Each request carries the `token` from the file, so no other local program can drive the editor. - **One server per window** (every VS Code window is its own extension host), so Revue picks the window, as with JetBrains. - In Revue: a `companions` module 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/vsce` and `ovsx` for publishing), with a Taskfile like Revue's: build, test (`@vscode/test-electron` against a fake `revue` that 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 1. The registration folder and `companions` module in Revue, with tests (a fake registration file, a stale one, a wrong token). 2. The extension's skeleton: finding `revue`, `--version`, Open or Create Pull Request, the status bar item. 3. The Pull Requests view and the details webview. 4. Editor markers, Open File in Pull Request, Add Pending Comment, Go to Pull Request File. 5. The local server and `/revue-open`, then #68 choosing it. 6. Docs: `docs/editors.md` gets a VS Code section; publishing to both marketplaces. Related: #68 (choosing the editor with a companion running), #66 (answers without the app running).
Author
Owner

Moved to thatrichan/revue-companion#1, where the companions live now (vscode/, next to jetbrains/). The Revue side of it (the companions registration folder and the editor chooser) stays here, in #68.

Moved to thatrichan/revue-companion#1, where the companions live now (`vscode/`, next to `jetbrains/`). The Revue side of it (the `companions` registration folder and the editor chooser) stays here, in #68.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thatrichan/revue#69
No description provided.