prlsp is an LSP server for surfacing GitHub PR review comments in-editor (as diagnostics), with commands/code-actions to create replies and new comments.
This repository also ships an Emacs package at emacs/prlsp.el and Neovim plugin at root directory.
The package provides Emacs-side UX helpers (without changing the LSP protocol):
prlsp-comment-on-line: open a markdown popup and submit a new review commentprlsp-reply-on-line: open a markdown popup and submit a reply to an existing threadprlsp-show-thread: show full thread content in a markdown side bufferprlsp-mode: minor mode auto-enabled only when the active server isprlsp
No keybindings are installed by default. Bind commands in your config.
(use-package prlsp
:straight (:host github :repo "toziegler/prlsp" :files ("emacs/*.el"))
:init
;; Optional customization before setup:
;; (setq prlsp-command '("prlsp_go"))
;; (setq prlsp-preferred-backend 'lsp) ; or 'eglot
;; (setq prlsp-auto-start t)
:config
(prlsp-setup))(global-set-key (kbd "C-c p c") #'prlsp-comment-on-line)
(global-set-key (kbd "C-c p r") #'prlsp-reply-on-line)
(global-set-key (kbd "C-c p s") #'prlsp-show-thread)(package! prlsp
:recipe (:host github :repo "toziegler/prlsp" :files ("emacs/*.el")))(use-package! prlsp
:init
;; Optional:
;; (setq prlsp-preferred-backend 'lsp)
;; (setq prlsp-command '("prlsp_go"))
:config
(prlsp-setup)
(map!
:localleader
(:prefix ("p" . "prlsp")
:desc "New PR comment" "c" #'prlsp-comment-on-line
:desc "Reply to thread" "r" #'prlsp-reply-on-line
:desc "Show thread" "s" #'prlsp-show-thread))
)prlsp-setupregisters bothlsp-modeandeglotintegrations.prlsp-preferred-backendonly controls which auto-start hooks are added.- If you prefer manual startup, set
(setq prlsp-auto-start nil)and start your backend yourself.
The plugin provides Lua API:
require("prlsp").comment_on_line(): open markdown buffer to write a new PR comment on current linerequire("prlsp").reply_on_line(): open markdown buffer to reply to a PR review thread on current linerequire("prlsp").show_thread(): show full review thread at current line in markdown side bufferrequire("prlsp").refresh(): refresh PR review threads
And the equivalent Ex-commands:
:PRLSPCommentOnLine:PRLSPReplyOnLine:PRLSPShowThread:PRLSPRefresh
-- Neovim 0.12+ required
vim.pack.add({ "https://github.com/toziegler/prlsp" })-- Note: plugin hardcodes prlsp LSP name
vim.lsp.config('prlsp', {
cmd = { 'prlsp' }, -- Name of LSP executable or path
root_markers = { '.git' },
})
vim.lsp.enable({'prlsp'})vim.keymap.set('', '<Leader>r', function()
require('prlsp').reply_on_line()
end)