Editors: companions other than JetBrains register through the revue command, so Open in editor can reach them #80
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?
The VS Code (thatrichan/revue-companion#1), Neovim (thatrichan/revue-companion#2) and Zed (thatrichan/revue-companion#5) companions need a way back: Revue opening a pull request in the running editor window that has its branch, as it does today for JetBrains IDEs through their built-in server. None of them has a server Revue can scan for, so each tells Revue it's there.
Ask
Companions register by running the
revuecommand, so none of them writes into Revue's data folder or needs to know where it is:revue --companion <kind> --pid <pid> [--socket <path>] [--port <port> --token <token>] [--app <name>] [--version <v>]: records a running companion.kindisvscode,nvimorzed. Neovim gives its RPC--socket(v:servername). VS Code and Zed give a127.0.0.1--portand a--tokenthat every request carries.--appis the editor's own name ("Visual Studio Code", "Cursor", "Zed Preview"…).revue --companion-gone --pid <pid>: removes it, run on the editor's shutdown.editor Nlevel inrevue --version, so companions only register when Revue understands it.In Revue
src/companion.rs:Companion::VsCode,Companion::ZedandCompanion::Nvimvariants besideJetBrains, with their finders inrunning_on.choosestays as it is (as the module's doc says)./api/revue-projectsand/api/revue-open:GET /revue-projectsandGET /revue-open?path=&repo=&branch=&file=&line=on the registered port, with the token.require("revue_companion").projects()andrequire("revue_companion").open({ path, repo, branch, file, line }).zed --existing <repo>/<file>:<line>once/revue-projectsnames the window.docs/command-line.md→ "What editors can ask" documents both flags.Tests
Registering and removing, a stale entry (pid gone), a refused port, a wrong token, and an
nvimclient round trip against a headless Neovim.