Skip to content

Draft: fix: improve discussions panel behaviour#552

Open
jakubbortlik wants to merge 2 commits into
harrisoncramer:developfrom
jakubbortlik:fix/open-discussions-immediately
Open

Draft: fix: improve discussions panel behaviour#552
jakubbortlik wants to merge 2 commits into
harrisoncramer:developfrom
jakubbortlik:fix/open-discussions-immediately

Conversation

@jakubbortlik
Copy link
Copy Markdown
Collaborator

This PR is based off my other PR #534, because it takes advantage of the async git system calls. That's why I'm putting it in Draft mode until #534 is merged.

This closes #510 and solves multiple other issues with the discussion panel:

  1. The discussion panel is now opened immediately after running :lua require("gitlab").review() or :lua require("gitlab").toggle_discussions() and the data is loaded after opening the split. This avoids the cursor focus being stolen with a delay or the discussions split being opened in an unexpected tab.
  2. The discussions panel can be configured so that the cursor is not placed in the split automatically after it opens.
  3. The cursor position is restored to the line and column anywhere in the discussion tree after rebuilding the tree and after toggling individual discussion nodes (before it was only restored after bulk toggle, always to the beginning of a line, and only if the cursor was already on a root node).
    • This required creating note body IDs as root node IDs + an index, rather than using random UUIDs. In my understanding, there was no real need for UUIDs for this and replacing with a simple root_node.id + line index has several benefits: Better cursor restoration, fewer lines of code.
  4. Autocommands are added that clean up the state when the discussion panel is closed so that toggling the discussions panel works correctly even after it was closed manually with something like :q.
  5. Discussion panel window options (nonumber, norelativenumber, breakindent, and showbreak) do not leak into the reviewer windows when toggling the discussions panel.
  6. The discussion split now has winfixbuf set so that no other buffer can be edited in the window (unless forced by the user).
  7. Buffer switching logic has been moved from the winbar module to the discussions module - this removes some of the spaghetti code that I introduced before.
  8. A deprecated function and some incorrect type annotations of optional parameters are fixed.

@jakubbortlik jakubbortlik force-pushed the fix/open-discussions-immediately branch from c9ade97 to 4186a8d Compare April 29, 2026 10:09
@jakubbortlik jakubbortlik linked an issue Apr 30, 2026 that may be closed by this pull request
3 tasks
@jakubbortlik jakubbortlik force-pushed the fix/open-discussions-immediately branch from 4186a8d to 11efb35 Compare May 22, 2026 05:55
@jakubbortlik jakubbortlik force-pushed the fix/open-discussions-immediately branch from 11efb35 to 7277599 Compare May 22, 2026 13:11
- Rebases the MR on the server.
- Pulls the remote branch after rebasing.
- Aborts rebase if it is not necessary, but enables forcing a rebase.
- Aborts rebase when there are conflicts.
- Adds keymaps for common rebase variants, and for reloading reviewer.
- Checks if branch is up-to-date asynchronously.
Main features:
- opens discussion tree immediately and loads data asynchronously
- improves restoring cursor position after rebuilding trees

Minor improvements:
- moves view type switching from winbar to discussions
- adds protection from invalid line number
- replaces deprecated vim.api function
@jakubbortlik jakubbortlik force-pushed the fix/open-discussions-immediately branch from 7277599 to fdc6a0f Compare May 22, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discussion window should be opened immediately

1 participant