Skip to content

Commit

Permalink
README updates
Browse files Browse the repository at this point in the history
Adds table of contents and shortens diagnostic section to most valuable
information
  • Loading branch information
harrisoncramer committed Nov 13, 2023
1 parent 4c7a610 commit 213b1f7
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,28 @@ And a lot more!

https://github.com/harrisoncramer/gitlab.nvim/assets/32515581/50f44eaf-5f99-4cb3-93e9-ed66ace0f675

## Table of Contents

[Requirements](#requirements)
[Quick Start](#quick-start)
[Installation](#installation)
[Connecting to Gitlab](#connecting-to-gitlab)
[Configuring the Plugin](#configuring-the-plugin)
[Usage](#usage)
- [The summary command](#summary)
- [Reviewing Diffs](#reviewing-diffs)
- [Discussions and Notes](#discussions-and-notes)
- [Discussion signs and diagnostics](#discussion-signs-and-diagnostics)
- [Discussion signs and diagnostics](#discussion-signs-and-diagnostics)
- [Uploading Files](#uploading-files)
- [MR Approvals](#mr-approvals)
- [Pipelines](#pipelines)
- [Reviewers and Assignees](#reviewers-and-assignees)
[Keybindings](#keybindings)
[Troubleshooting](#troubleshooting)
[Extras](#extra-goodies)


## Requirements

- <a href="https://go.dev/">Go</a> >= v1.19
Expand Down Expand Up @@ -64,7 +86,7 @@ use {
}
```

## Project Configuration
## Connecting to Gitlab

This plugin requires an <a href="https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token">auth token</a> to connect to Gitlab. The token can be set in the root directory of the project in a `.gitlab.nvim` environment file, or can be set via a shell environment variable called `GITLAB_TOKEN` instead. If both are present, the `.gitlab.nvim` file will take precedence.

Expand Down Expand Up @@ -218,17 +240,17 @@ If you'd like to create a note in an MR (like a comment, but not linked to a spe
require("gitlab").create_note()
```

### Discussions signs and diagnostics
### Discussion signs and diagnostics

By default when reviewing files you will see signs and diagnostics ( if enabled in configuration ). When cursor is on diagnostic line you can view discussion thread by using `vim.diagnostic.show`. You can also jump to discussion tree where you can reply, edit or delete discussion.

```lua
require("gitlab").move_to_discussion_tree_from_diagnostic()
```

The `discussion_sign` configuration controls the display of signs for discussions. The `enabled` option turns on/off the signs. `text` sets the sign text. `linehl`, `texthl`, `culhl`, and `numhl` customize the line highlighting, text highlighting, column highlighting, and number highlighting respectively. Keep in mind that these can be overridden by other configuration (for example diffview.nvim highlights). `priority` controls the sign priority order (when multiple signs are placed on the same line, the sign with highest priority is used). The `helper_signs` table configures additional signs for multiline discussions in order to show the whole context. `enabled` turns on/off the helper signs. `start`, `mid`, and `end` set the helper sign text.
The `discussion_sign` configuration controls the display of signs for discussions in the reviewer pane. Keep in mind that the highlights provided here can be overridden by other highlights (for example from diffview.nvim). The `priority` setting controls the sign priority order (when multiple signs are placed on the same line, the sign with highest priority is used). The `helper_signs` table configures additional signs for multiline discussions in order to show the whole context.

The `discussion_diagnostic` configuration customizes the diagnostic display for discussions. The `enabled` option turns on/off the diagnostics. `severity` sets the diagnostic severity level and should be set to one of `vim.diagnostic.severity.ERROR`, `vim.diagnostic.severity.WARN`, or `vim.diagnostic.severity.INFO`, `vim.diagnostic.severity.HINT`. `code` specifies a diagnostic code. `display_opts` configures the diagnostic display options where you can configure values like (this is dirrectly used as opts in vim.diagnostic.set):
The `discussion_diagnostic` configuration customizes the diagnostic display for discussions. The `severity` key sets the diagnostic severity level and should be set to one of `vim.diagnostic.severity.ERROR`, `vim.diagnostic.severity.WARN`, `vim.diagnostic.severity.INFO`, or `vim.diagnostic.severity.HINT`. The `display_opts` option configures the diagnostic display options where you can configure values like (this is dirrectly used as opts in vim.diagnostic.set):

- `virtual_text` - Show virtual text for diagnostics.
- `underline` - Underline text for diagnostics.
Expand All @@ -240,9 +262,7 @@ Signs and diagnostics have common settings in `discussion_sign_and_diagnostics`.
- `skip_resolved_discussion` - Whether to skip showing signs and diagnostics for resolved discussions. Default is `false`, meaning signs and diagnostics will be shown for resolved discussions.
- `skip_old_revision_discussion` - Whether to skip showing signs and diagnostics for discussions on outdated diff revisions. Default is `true`, meaning signs and diagnostics won't be shown for discussions no longer relevant to the current diff.

#### Limitations

When checking multiline diagnostic the cursor must be on the "main" line of diagnostic -> where the `discussion_sign.text` is shown otherwise `vim.diagnostic.show` and `jump_to_discussion_tree_from_diagnostic` will not work.
When interacting with multiline comments, the cursor must be on the "main" line of diagnostic, where the `discussion_sign.text` is shown, otherwise `vim.diagnostic.show` and `jump_to_discussion_tree_from_diagnostic` will not work.

### Uploading Files

Expand Down

0 comments on commit 213b1f7

Please sign in to comment.