Winbar Support + Notes and Discussions; Help Popup + Auto-Open (#133)

- Adds support for toggling between discussions and notes views
- Deprecates the split view shared with both discussions and notes at the same time
- Adds winbar to discussion split, with metadata about resolved and unresolved discussions
- Adds help popups with information about keybindings for all views
- Modifies highlights in discussion tree and default symbol for unresolved discussions

This is a MINOR version bump as the default behavior of the discussion tree is changed slightly. Existing configurations should still function.
This commit is contained in:
Harrison (Harry) Cramer
2023-12-13 17:46:34 -05:00
committed by GitHub
parent d5038d63ca
commit d5510f9d9a
13 changed files with 588 additions and 428 deletions

View File

@@ -0,0 +1,27 @@
local M = {}
local u = require("gitlab.utils")
local state = require("gitlab.state")
local Popup = require("nui.popup")
M.open = function()
local bufnr = vim.api.nvim_get_current_buf()
local keymaps = vim.api.nvim_buf_get_keymap(bufnr, "n")
local help_content_lines = {}
for _, keymap in ipairs(keymaps) do
if keymap.desc ~= nil then
local new_line = string.format("%s: %s", keymap.lhs, keymap.desc)
table.insert(help_content_lines, new_line)
end
end
local longest_line = u.get_longest_string(help_content_lines)
local help_popup =
Popup(u.create_popup_state("Help", state.settings.popup.help, longest_line + 3, #help_content_lines + 3, 60))
help_popup:mount()
state.set_popup_keymaps(help_popup, "Help", nil)
local currentBuffer = vim.api.nvim_get_current_buf()
vim.api.nvim_buf_set_lines(currentBuffer, 0, #help_content_lines, false, help_content_lines)
end
return M