Multiline comment and suggestion (#66)

This MR adds the ability to leave multi-line comments and suggested changes to an MR. The features are only supported for `diffview` because we plan to deprecate `delta` as a reviewer soon.
This commit is contained in:
johnybx
2023-10-31 02:58:53 +01:00
committed by GitHub
parent f853c2f940
commit 3a67424fec
11 changed files with 689 additions and 161 deletions

View File

@@ -158,13 +158,16 @@ The upper part of the popup contains the title, which can also be edited and sen
### Reviewing Diffs
The `review` action will open a diff of the changes. You can leave comments using the `create_comment` action.
The `review` action will open a diff of the changes. You can leave comments using the `create_comment` action or for multiline comments use `create_multiline_comment` in visual mode.
```lua
require("gitlab").review()
require("gitlab").create_comment()
require("gitlab").create_multiline_comment()
```
For suggesting changes you can use `create_comment_suggestion` in visual mode which works similar to `create_multiline_comment` but prefills the comment window with gitlab [suggest changes](https://docs.gitlab.com/ee/user/project/merge_requests/reviews/suggestions.html) code block with prefilled code from visual selection.
The reviewer is Delta by default, but you can configure the plugin to use Diffview instead.
### Discussions and Notes
@@ -246,6 +249,8 @@ vim.keymap.set("n", "<leader>gls", gitlab.summary)
vim.keymap.set("n", "<leader>glA", gitlab.approve)
vim.keymap.set("n", "<leader>glR", gitlab.revoke)
vim.keymap.set("n", "<leader>glc", gitlab.create_comment)
vim.keymap.set("v", "<leader>glc", gitlab.create_multiline_comment)
vim.keymap.set("v", "<leader>glC", gitlab.create_comment_suggestion)
vim.keymap.set("n", "<leader>gln", gitlab.create_note)
vim.keymap.set("n", "<leader>gld", gitlab.toggle_discussions)
vim.keymap.set("n", "<leader>glaa", gitlab.add_assignee)