Feat: Create Merge Request (#149)

- Adds the ability to create MRs to the plugin
- Adds the ability to jump to specific discussions/notes in the browser
- Fixes stale icons
- Adds debug keybinding for discussion tree for developers
This commit is contained in:
Harrison (Harry) Cramer
2023-12-19 13:41:07 -05:00
committed by GitHub
parent 35f0bc16a5
commit 37a53842d0
38 changed files with 814 additions and 204 deletions

View File

@@ -3,21 +3,6 @@ local u = require("gitlab.utils")
local job = require("gitlab.job")
local M = {}
M.open_in_browser = function()
local url = state.INFO.web_url
if url == nil then
u.notify("Could not get Gitlab URL", vim.log.levels.ERROR)
return
end
if vim.fn.has("mac") == 1 then
vim.fn.jobstart({ "open", url })
elseif vim.fn.has("unix") == 1 then
vim.fn.jobstart({ "xdg-open", url })
else
u.notify("Opening a Gitlab URL is not supported on this OS!", vim.log.levels.ERROR)
end
end
M.attach_file = function()
local attachment_dir = state.settings.attachment_dir
if not attachment_dir or attachment_dir == "" then
@@ -40,7 +25,7 @@ M.attach_file = function()
end
local full_path = attachment_dir .. u.path_separator .. choice
local body = { file_path = full_path, file_name = choice }
job.run_job("/mr/attachment", "POST", body, function(data)
job.run_job("/attachment", "POST", body, function(data)
local markdown = data.markdown
local current_line = u.get_current_line_number()
local bufnr = vim.api.nvim_get_current_buf()