This MR fixes the check for The `diffview` reviewer. Rather than checking for the presence of the command, we check for the module itself.
This commit is contained in:
Harrison (Harry) Cramer
2023-10-31 18:46:18 -04:00
committed by GitHub
parent 23232439b6
commit 6b7e67b325
2 changed files with 12 additions and 12 deletions

View File

@@ -158,12 +158,13 @@ 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 or for multiline comments use `create_multiline_comment` in visual mode.
The `review` action will open a diff of the changes. You can leave comments using the `create_comment` action. In visual mode, add multiline comments with the `create_multiline_comment` command, and add suggested changes with the `create_comment_suggestion` command.
```lua
require("gitlab").review()
require("gitlab").create_comment()
require("gitlab").create_multiline_comment()
require("gitlab").create_multiline_comment() -- Only supported for diffview reviewer
require("gitlab").create_comment_suggestion() -- Only supported for diffview reviewer
```
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.
@@ -267,7 +268,7 @@ vim.keymap.set("n", "<leader>glo", gitlab.open_in_browser)
This plugin uses a Golang server to reach out to Gitlab. It's possible that something is going wrong when starting that server or connecting with Gitlab. The Golang server runs outside of Neovim, and can be interacted with directly in order to troubleshoot. To start the server, check out your feature branch and run these commands:
```
```lua
:lua require("gitlab.server").build(true)
:lua require("gitlab.server").start(function() print("Server started") end)
```

View File

@@ -6,18 +6,17 @@ M.get_current_line_number = function()
end
M.has_reviewer = function(reviewer)
local has_reviewer
if reviewer == "diffview" then
has_reviewer = vim.fn.exists(":DiffviewOpen") ~= 0
local diffview_ok, _ = pcall(require, "diffview")
if not diffview_ok then
error("Please install diffview or change your reviewer")
end
else
has_reviewer = vim.fn.executable("delta") == 1
end
local has_reviewer = vim.fn.executable("delta") == 1
if not has_reviewer then
error(string.format("Please install %s or change your reviewer", reviewer))
error(string.format("Please install delta or change your reviewer", reviewer))
end
end
return has_reviewer
end
M.is_windows = function()