feat(utils): add type annotations and inline documentation to various utility modules

This commit is contained in:
2024-08-31 03:02:33 -04:00
parent 5ef3bc7445
commit a23fc9c643
9 changed files with 173 additions and 42 deletions
+13 -3
View File
@@ -1,7 +1,13 @@
---@module "utils.git"
--- This module provides functions to interact with GitGraph within Neovim.
--- It includes functions to draw, close, and toggle the GitGraph tab.
local M = {}
--- Opens the GitGraph in a new tab if it's not already open.
--- @return nil
function M.gitgraph_draw()
-- open gitgraph in a seperate tab
-- Open gitgraph in a separate tab
if vim.bo.filetype == "gitgraph" then
return
end
@@ -9,8 +15,10 @@ function M.gitgraph_draw()
require("gitgraph").draw({}, { all = true, max_count = 5000 })
end
--- Closes the tab page if it is a GitGraph page.
--- @return nil
function M.gitgraph_close()
--- close the tab page if it is a gitgraph page
-- Close the tab page if it is a gitgraph page
if vim.bo.filetype == "gitgraph" then
vim.cmd("tabclose")
else
@@ -18,8 +26,10 @@ function M.gitgraph_close()
end
end
--- Toggles the GitGraph tab. Opens it if not already open, and closes it if it is.
--- @return nil
function M.gitgraph_toggle()
-- toggle gitgraph
-- Toggle gitgraph
if vim.bo.filetype == "gitgraph" then
M.gitgraph_close()
else