From b3e5f85caff349b40e2f5685a63239b5d29acac2 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Mon, 16 Sep 2024 16:44:33 -0400 Subject: [PATCH] docs: use correct param notation --- lua/astrocore/buffer.lua | 4 ++-- lua/astrocore/init.lua | 8 ++++---- lua/astrocore/rooter.lua | 22 +++++++++++----------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lua/astrocore/buffer.lua b/lua/astrocore/buffer.lua index 4cfa742..70bb590 100644 --- a/lua/astrocore/buffer.lua +++ b/lua/astrocore/buffer.lua @@ -17,7 +17,7 @@ M.sessions = astro.config.sessions M.current_buf, M.last_buf = nil, nil --- Check if a buffer is valid ----@param bufnr integer? The buffer to check, default to current buffer +---@param bufnr? integer The buffer to check, default to current buffer ---@return boolean # Whether the buffer is valid or not function M.is_valid(bufnr) if not bufnr then bufnr = 0 end @@ -25,7 +25,7 @@ function M.is_valid(bufnr) end --- Check if a buffer has a filetype ----@param bufnr integer? The buffer to check, default to current buffer +---@param bufnr? integer The buffer to check, default to current buffer ---@return boolean # Whether the buffer has a filetype or not function M.has_filetype(bufnr) if not bufnr then bufnr = 0 end diff --git a/lua/astrocore/init.lua b/lua/astrocore/init.lua index 2b0c9a4..a35657b 100644 --- a/lua/astrocore/init.lua +++ b/lua/astrocore/init.lua @@ -97,7 +97,7 @@ end --- Trigger an AstroNvim user event ---@param event string|vim.api.keyset_exec_autocmds The event pattern or full autocmd options (pattern always prepended with "Astro") ----@param instant boolean? Whether or not to execute instantly or schedule +---@param instant? boolean Whether or not to execute instantly or schedule function M.event(event, instant) if type(event) == "string" then event = { pattern = event } end event = M.extend_tbl({ modeline = false }, event) @@ -298,7 +298,7 @@ M.url_matcher = "\\v\\c%(%(h?ttps?|ftp|file|ssh|git)://|[a-z]+[@][a-z]+[.][a-z]+:)%([&:#*@~%_\\-=?!+;/0-9a-z]+%(%([.;/?]|[.][.]+)[&:#*@~%_\\-=?!+/0-9a-z]+|:\\d+|,%(%(%(h?ttps?|ftp|file|ssh|git)://|[a-z]+[@][a-z]+[.][a-z]+:)@![0-9a-z]+))*|\\([&:#*@~%_\\-=?!+;/.0-9a-z]*\\)|\\[[&:#*@~%_\\-=?!+;/.0-9a-z]*\\]|\\{%([&:#*@~%_\\-=?!+;/.0-9a-z]*|\\{[&:#*@~%_\\-=?!+;/.0-9a-z]*})\\})+" --- Delete the syntax matching rules for URLs/URIs if set ----@param win integer? the window id to remove url highlighting in (default: current window) +---@param win? integer the window id to remove url highlighting in (default: current window) function M.delete_url_match(win) if not win then win = vim.api.nvim_get_current_win() end for _, match in ipairs(vim.fn.getmatches(win)) do @@ -308,7 +308,7 @@ function M.delete_url_match(win) end --- Add syntax matching rules for highlighting URLs/URIs ----@param win integer? the window id to remove url highlighting in (default: current window) +---@param win? integer the window id to remove url highlighting in (default: current window) function M.set_url_match(win) if not win then win = vim.api.nvim_get_current_win() end M.delete_url_match(win) @@ -334,7 +334,7 @@ function M.cmd(cmd, show_error) end --- Get the first worktree that a file belongs to ----@param file string? the file to check, defaults to the current file +---@param file? string the file to check, defaults to the current file ---@param worktrees table[]? an array like table of worktrees with entries `toplevel` and `gitdir`, default retrieves from `vim.g.git_worktrees` ---@return table|nil # a table specifying the `toplevel` and `gitdir` of a worktree or nil if not found function M.file_worktree(file, worktrees) diff --git a/lua/astrocore/rooter.lua b/lua/astrocore/rooter.lua index 172c1db..3cffb21 100644 --- a/lua/astrocore/rooter.lua +++ b/lua/astrocore/rooter.lua @@ -29,7 +29,7 @@ end local function resolve_config() return require("astrocore").config.rooter or {} end --- Create a detect workspace folders from active language servers ----@param config AstroCoreRooterOpts? a rooter configuration (defaults to global configuration) +---@param config? AstroCoreRooterOpts a rooter configuration (defaults to global configuration) ---@return AstroCoreRooterDetectorFunc function M.detectors.lsp(config) if not config then config = resolve_config() end @@ -88,7 +88,7 @@ end function M.bufpath(bufnr) return M.realpath(vim.api.nvim_buf_get_name(bufnr)) end --- Resolve a given path ----@param path string? the path to resolve +---@param path? string the path to resolve ---@return string? the resolved path function M.realpath(path) if not path or path == "" then return nil end @@ -115,7 +115,7 @@ end --- Resolve the root detection function for a given spec ---@param spec AstroCoreRooterSpec the root detector specification ----@param config AstroCoreRooterOpts? the root configuration +---@param config? AstroCoreRooterOpts the root configuration ---@return function function M.resolve(spec, config) if M.detectors[spec] then @@ -128,9 +128,9 @@ function M.resolve(spec, config) end --- Detect roots in a given buffer ----@param bufnr integer? the buffer to detect ----@param all boolean? whether to return all roots or just one ----@param config AstroCoreRooterOpts? a rooter configuration (defaults to global configuration) +---@param bufnr? integer the buffer to detect +---@param all? boolean whether to return all roots or just one +---@param config? AstroCoreRooterOpts a rooter configuration (defaults to global configuration) ---@return AstroCoreRooterRoot[] detected roots function M.detect(bufnr, all, config) if not config then config = resolve_config() end @@ -164,7 +164,7 @@ function M.detect(bufnr, all, config) end --- Get information information about the current root ----@param config AstroCoreRooterOpts? a rooter configuration (defaults to global configuration) +---@param config? AstroCoreRooterOpts a rooter configuration (defaults to global configuration) function M.info(config) if not config then config = resolve_config() end local lines = {} @@ -207,7 +207,7 @@ end --- Set the current directory to a given root ---@param root AstroCoreRooterRoot the root to set the pwd to ----@param config AstroCoreRooterOpts? a rooter configuration (defaults to global configuration) +---@param config? AstroCoreRooterOpts a rooter configuration (defaults to global configuration) ---@return boolean success whether or not the pwd was successfully set function M.set_pwd(root, config) if not config then config = resolve_config() end @@ -235,7 +235,7 @@ end --- Check if a path is excluded ---@param path string the path ----@param config AstroCoreRooterOpts? a rooter configuration (defaults to global configuration) +---@param config? AstroCoreRooterOpts a rooter configuration (defaults to global configuration) ---@return boolean excluded whether or not the path is excluded function M.is_excluded(path, config) if not config then config = resolve_config() end @@ -246,8 +246,8 @@ function M.is_excluded(path, config) end --- Run the root detection and set the current working directory if a new root is detected ----@param bufnr integer? the buffer to detect ----@param config AstroCoreRooterOpts? a rooter configuration (defaults to global configuration) +---@param bufnr? integer the buffer to detect +---@param config? AstroCoreRooterOpts a rooter configuration (defaults to global configuration) function M.root(bufnr, config) -- add `autochdir` protection local autochdir = vim.opt.autochdir:get()