Revue Companion for Neovim #70
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 Neovim plugin, revue-companion.nvim, doing what the JetBrains plugin (jetbrains-plugins/revue-companion) does, in Neovim's way: commands, a pull request list in a buffer or picker, signs in the gutter, and Revue opening a pull request in the running Neovim that has its branch.
Neovim 0.10 or later, pure Lua, no other dependency (Telescope, fzf-lua and snacks pickers used when present).
Features
:Revue/:Revue open: the current branch's pull request in Revue, or its New pull request page (revue --pull-request <dir>).:Revue list: the repository's open pull requests (revue --pulls, with--show, drafts, search, pages) in Revue's sections (This branch, To review, Mine, Others), in a picker when one is installed, else a scratch buffer.<CR>opens the details buffer (revue --pull): review, checks, conflicts, files, conversation, stack; mappings to open in Revue or the browser, yank the link, switch to the branch, create the worktree (--worktree), fetch the branch (--fetch-branch).--branch-pull,--pending);:Revue fileopens the file in the pull request at the cursor's line;:Revue commenton a visual selection adds a pending comment (--comment, the body typed in a small floating window);:Revue fileslists the pull request's files to jump to.statuslinecomponent: the branch's pull request number and state, for lualine and others.require("revue_companion").setup({ path = …, signs = …, keys = … }): therevueexecutable (empty: PATH, then the install places the JetBrains plugin looks in), no default mappings beyond the buffer-local ones in its own windows.:checkhealth revue_companion: findsrevue, readsrevue --version'seditor <N>line, and says whether Revue is running.It talks to Revue only through the
revuecommand (docs/command-line.md, "What editors can ask"), run withvim.systemso nothing blocks the editor. No tokens enter Neovim.The way back: Revue reaching a running Neovim
Every Neovim already listens on an RPC socket (
v:servername), so it needs no server of its own:<Revue's data folder>/companions/nvim-<pid>.jsonwith{ "kind": "nvim", "pid", "socket": v:servername, "version" }, written at startup and removed onVimLeavePre. Revue ignores a stale file (pid gone, socket refusing).require("revue_companion").projects()(cwd and tabs' working directories, each repository's root, branch and remotes, whether the UI is focused) andrequire("revue_companion").open({ path, repo, branch, file, line })(:tcdto the folder in a new tab unless one has the branch, then:edit fileat the line).$WINDOWIDor the terminal's process on Linux), and says so when it can't.companionsmodule from the VS Code issue reads these files too, and annvimclient (a small msgpack-RPC call over the socket: Unix socket, or named pipe on Windows) does the two requests. #68's chooser then treats Neovim like any other companion.Where it lives
A new repository,
revue-companion.nvim(the layout plugin managers expect:lua/revue_companion/,plugin/,doc/revue-companion.txt), with a Taskfile: tests withbustedormini.testin headless Neovim against a fakerevueprinting fixture JSON,styluaandluacheck, and releases as tags (lazy.nvim, packer and vim.pack install from the repository).Plan
companionsregistration in Revue (shared with VS Code) and itsnvimRPC client, with tests against a headless Neovim.revue: open, list, details, file, comment, files, health.docs/editors.mdgets a Neovim section, and:help revue-companion.Related: #68 (choosing the editor with a companion running), the VS Code companion issue, #66 (answers without the app running).
Moved to thatrichan/revue-companion#2, where the companions live now (
nvim/, next tojetbrains/). The Revue side of it (thecompanionsregistration folder, thenvimRPC client and the editor chooser) stays here, in #68.