You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BREAKING CHANGE: Delta Pager + Large Refactor (#43)
BREAKING CHANGE: This MR addresses an underlying issue with the original implementation in regards to detecting line numbers for comments.
As such, this is a major breaking change. The setup function signature has changed, please review the `README.md` for the new arguments. The delta pager has also been added as a dependency: https://github.com/dandavison/delta
There will be future work to implement a native solution for parsing changes and line numbers.
@@ -77,35 +84,40 @@ Here is the default setup function. All of these values are optional, and if you
77
84
78
85
```lua
79
86
require("gitlab").setup({
80
-
port=20136, -- The port of the Go server, which runs in the background
81
-
log_path=vim.fn.stdpath("cache") .."gitlab.nvim.log", -- Log path for the Go server
82
-
keymaps= {
83
-
popup= { -- The popup for comment creation, editing, and replying
84
-
exit="<Esc>",
85
-
perform_action="<leader>s", -- Once in normal mode, does action (like saving comment or editing description, etc)
86
-
},
87
-
discussion_tree= { -- The discussion tree that holds all comments
88
-
jump_to_location="o", -- Jump to comment location in file
89
-
edit_comment="e", -- Edit coment
90
-
delete_comment="dd", -- Delete comment
91
-
reply_to_comment="r", -- Reply to comment
92
-
toggle_resolved="p" -- Toggles the resolved status of the discussion
93
-
toggle_node="t", -- Opens or closes the discussion
94
-
position="left", -- "top", "right", "bottom" or "left"
95
-
relative="editor" -- Position of tree split relative to "editor" or "window"
96
-
size="20%", -- Size of split
97
-
},
98
-
dialogue= { -- The confirmation dialogue for deleting comments
99
-
focus_next= { "j", "<Down>", "<Tab>" },
100
-
focus_prev= { "k", "<Up>", "<S-Tab>" },
101
-
close= { "<Esc>", "<C-c>" },
102
-
submit= { "<CR>", "<Space>" },
103
-
}
87
+
port=21036, -- The port of the Go server, which runs in the background
88
+
log_path=vim.fn.stdpath("cache") .."/gitlab.nvim.log", -- Log path for the Go server
89
+
reviewer="delta", -- The reviewer type (only delta is currently supported)
90
+
popup= { -- The popup for comment creation, editing, and replying
91
+
exit="<Esc>",
92
+
perform_action="<leader>s", -- Once in normal mode, does action (like saving comment or editing description, etc)
104
93
},
105
-
symbols= {
94
+
discussion_tree= { -- The discussion tree that holds all comments
95
+
jump_to_file="o", -- Jump to comment location in file
96
+
jump_to_reviewer="m", -- Jump to the location in the reviewer window
97
+
edit_comment="e", -- Edit coment
98
+
delete_comment="dd", -- Delete comment
99
+
reply="r", -- Reply to comment
100
+
toggle_node="t", -- Opens or closes the discussion
101
+
toggle_resolved="p", -- Toggles the resolved status of the discussion
102
+
position="left", -- "top", "right", "bottom" or "left"
103
+
size="20%", -- Size of split
104
+
relative="editor", -- Position of tree split relative to "editor" or "window"
106
105
resolved='✓', -- Symbol to show next to resolved discussions
107
106
unresolved='✖', -- Symbol to show next to unresolved discussions
108
-
}
107
+
},
108
+
review_pane= { -- Specific settings for different reviewers
109
+
delta= {
110
+
added_file="", -- The symbol to show next to added files
111
+
modified_file="", -- The symbol to show next to modified files
112
+
removed_file="", -- The symbol to show next to removed files
113
+
}
114
+
},
115
+
dialogue= { -- The confirmation dialogue for deleting comments
116
+
focus_next= { "j", "<Down>", "<Tab>" },
117
+
focus_prev= { "k", "<Up>", "<S-Tab>" },
118
+
close= { "<Esc>", "<C-c>" },
119
+
submit= { "<CR>", "<Space>" },
120
+
},
109
121
})
110
122
```
111
123
@@ -117,31 +129,42 @@ First, check out the branch that you want to review locally.
117
129
git checkout feature-branch
118
130
```
119
131
120
-
Then open Neovim and the reviewer will be initialized. The `project_id` you specify in your configuration file must match the project_id of the Gitlab project your terminal is inside of.
132
+
Then open Neovim. The `project_id` you specify in your configuration file must match the project_id of the Gitlab project your terminal is inside of.
121
133
122
134
The `summary` command will pull down the MR description into a buffer so that you can read it. To edit the description, edit the buffer and press the `perform_action` keybinding when in normal mode (it's `<leader>s` by default):
123
135
124
136
```lua
125
137
require("gitlab").summary()
126
138
```
127
139
128
-
129
-
The `approve` command will approve the merge request for the current branch:
140
+
The `review` command will open up view of all the changes that have been made in this MR compared to the target branch in a review pane. You can leave comments on the changes.
130
141
131
142
```lua
132
-
require("gitlab").approve()
143
+
require("gitlab").review()
144
+
require("gitlab").create_comment()
133
145
```
134
146
135
-
The `revoke` command will revoke approval for the merge request for the current branch:
147
+
Gitlab groups threads of comments together into "discussions."
148
+
149
+
To display discussions for the current MR, use the `list_discussions()` command, which will show the discussions in a split window.
150
+
151
+
You can jump to the comment's location the reviewer window by using the `m` key, or the actual file with the 'j' key, when hovering over the line in the tree.
152
+
153
+
Within the discussion tree, you can delete/edit/reply to comments, or toggle them as resolved or not.
136
154
137
155
```lua
138
-
require("gitlab").revoke()
156
+
require("gitlab").list_discussions()
157
+
require("gitlab").delete_comment()
158
+
require("gitlab").edit_comment()
159
+
require("gitlab").reply()
160
+
require("gitlab").toggle_resolved()
139
161
```
140
162
141
-
The `comment` command will open up a NUI popover that will allow you to create a Gitlab comment on the current line. To send the comment, use `<leader>s` while the comment popup is open:
163
+
You can approve or revoke approval for an MR:
142
164
143
165
```lua
144
-
require("gitlab").create_comment()
166
+
require("gitlab").approve()
167
+
require("gitlab").revoke()
145
168
```
146
169
147
170
The `add_reviewer` and `delete_reviewer` commands, as well as the `add_assignee` and `delete_assignee` functions, will let you choose from a list of users who are availble in the current project:
@@ -163,23 +186,6 @@ require("dressing").setup({
163
186
})
164
187
```
165
188
166
-
### Discussions
167
-
168
-
Gitlab groups threads of notes together into "discussions." To get a list of all the discussions for the current MR, use the `list_discussions` command. This command will open up a split view of all the comments on the current merge request. You can jump to the comment location by using the `o` key in the tree buffer, and you can reply to a thread by using the `r` keybinding in the tree buffer:
169
-
170
-
```lua
171
-
require("gitlab").list_discussions()
172
-
```
173
-
174
-
Within the discussion tree, there are several functions that you can call, however, it's better to use the keybindings provided in the setup function. If you want to call them manually, they are:
175
-
176
-
```lua
177
-
require("gitlab").delete_comment()
178
-
require("gitlab").edit_comment()
179
-
require("gitlab").reply()
180
-
require("gitlab").toggle_resolved()
181
-
```
182
-
183
189
## Keybindings
184
190
185
191
The plugin does not set up any keybindings outside of these buffers, you need to set them up yourself. Here's what I'm using:
@@ -189,8 +195,7 @@ local gitlab = require("gitlab")
**To check that the current settings of the plugin are configured correctly, please run: `:lua require("gitlab").print_settings()`**
208
+
202
209
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:
203
210
204
211
```
205
-
:lua require("gitlab").build()
206
-
:lua require("gitlab").start_server()
212
+
:lua require("gitlab.server").build()
213
+
:lua require("gitlab.server").start()
207
214
```
208
215
209
216
You can directly interact with the Go server like any other process:
0 commit comments