From d52b41f16efb2d0778687ad5ab2509aaa03e6287 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Thu, 3 Aug 2023 13:56:29 -0400 Subject: [PATCH] feat: move to `lua_ls` only annotations --- config.ld | 11 ---- lua/astroui/config.lua | 104 ++++++++++++++++++++++--------- lua/astroui/ffi.lua | 2 +- lua/astroui/init.lua | 8 +-- lua/astroui/status.lua | 8 +-- lua/astroui/status/component.lua | 7 +-- lua/astroui/status/condition.lua | 7 +-- lua/astroui/status/heirline.lua | 7 +-- lua/astroui/status/hl.lua | 7 +-- lua/astroui/status/init.lua | 7 +-- lua/astroui/status/provider.lua | 7 +-- lua/astroui/status/utils.lua | 7 +-- lua/astroui/types.lua | 31 --------- 13 files changed, 104 insertions(+), 109 deletions(-) delete mode 100644 config.ld delete mode 100644 lua/astroui/types.lua diff --git a/config.ld b/config.ld deleted file mode 100644 index a215561..0000000 --- a/config.ld +++ /dev/null @@ -1,11 +0,0 @@ -project='AstroUI' -title='AstroUI API' -description='Documentation of AstroNvim\'s UI API' -favicon = "https://astronvim.com/img/logo/favicon-16x16.png" -backtick_references = false -format = 'markdown' -file='lua' -dir='docs' -readme = "README.md" -style = "!new" -no_space_before_args=true diff --git a/lua/astroui/config.lua b/lua/astroui/config.lua index 50036c4..1b937e4 100644 --- a/lua/astroui/config.lua +++ b/lua/astroui/config.lua @@ -1,41 +1,87 @@ ---- ### AstroNvim UI Configuration +-- AstroNvim UI Configuration -- -- This module simply defines the configuration table structure for `opts` used in: -- -- require("astroui").setup(opts) -- --- @module astroui.config --- @copyright 2023 --- @license GNU General Public License v3.0 +-- copyright 2023 +-- license GNU General Public License v3.0 + +---@alias AstroUIIconTable table +---@alias AstroUIIconHighlight (fun(self:table):boolean)|boolean + +---@class AstroUIFullIconHighlights +---@field tabline AstroUIIconHighlight? +---@field statusline AstroUIIconHighlight? +---@field winbar AstroUIIconHighlight? + +---@class AstroUIIconHighlights +---@field breadcrumbs AstroUIIconHighlight? +---@field file_icon AstroUIFullIconHighlights? + +---@class AstroUIStatusOpts +---@field attributes table? +---@field buf_matchers table? +---@field colors table? +---@field fallback_colors table? +---@field icon_hignlights AstroUIIconHighlights? +---@field modes table? +---@field separators table? +---@field setup_colors (fun():table)? +---@field sign_handlers table? + +---@class AstroUIConfig +-- Colorscheme set on startup, a string that is used with `:colorscheme astrodark` +-- Example: +-- +-- ```lua +-- colorscheme = "astrodark" +-- ``` +---@field colorscheme string? +-- Override highlights in any colorscheme +-- Keys can be: +-- `init`: table of highlights to apply to all colorschemes +-- `` override highlights in the colorscheme with name: `` +-- Example: +-- +-- ```lua +-- highlights = { +-- -- this table overrides highlights in all colorschemes +-- init = { +-- Normal = { bg = "#000000" }, +-- }, +-- -- a table of overrides/changes when applying astrotheme +-- astrotheme = { +-- Normal = { bg = "#000000" }, +-- }, +-- } +-- ``` +---@field highlights table>? +-- A table of icons in the UI using NERD fonts +-- Example: +-- +-- ```lua +-- icons = { +-- GitAdd = "", +-- } +-- ``` +---@field icons AstroUIIconTable? +--- A table of only text "icons" used when icons are disabled +-- Example: +-- +-- ```lua +-- text_icons = { +-- GitAdd = "[+]", +-- } +-- ``` +---@field text_icons AstroUIIconTable? +---@field status AstroUIStatusOpts? ---@type AstroUIConfig -return { - --- Colorscheme set on startup - -- @usage colorscheme = "astrodark" +local M = { colorscheme = nil, - --- Override highlights in any colorscheme - -- @field init table of highlights to apply to all colorschemes - -- @field colorscheme_name override highlights in the colorscheme with name: `colorscheme_name` - -- @usage highlights = { - -- -- this table overrides highlights in all colorschemes - -- init = { - -- Normal = { bg = "#000000" }, - -- }, - -- -- a table of overrides/changes when applying astrotheme - -- astrotheme = { - -- Normal = { bg = "#000000" }, - -- }, - -- } highlights = {}, - --- A table of icons in the UI using NERD fonts - -- @usage icons = { - -- GitAdd = "", - -- } icons = {}, - --- A table of only text "icons" used when icons are disabled - -- @usage text_icons = { - -- GitAdd = "[+]", - -- } text_icons = {}, status = { attributes = {}, @@ -49,3 +95,5 @@ return { sign_handlers = {}, }, } + +return M diff --git a/lua/astroui/ffi.lua b/lua/astroui/ffi.lua index e0a1c26..a10b064 100644 --- a/lua/astroui/ffi.lua +++ b/lua/astroui/ffi.lua @@ -1,4 +1,4 @@ --- ### AstroUI C Extensions +-- AstroUI C Extensions local ffi = require "ffi" diff --git a/lua/astroui/init.lua b/lua/astroui/init.lua index 9e3942d..3b5d9ee 100644 --- a/lua/astroui/init.lua +++ b/lua/astroui/init.lua @@ -1,12 +1,11 @@ ---- ### AstroNvim UI Utilities +-- AstroNvim UI Utilities -- -- UI utility functions to use within AstroNvim and user configurations. -- -- This module can be loaded with `local astro = require "astroui"` -- --- @module astroui --- @copyright 2023 --- @license GNU General Public License v3.0 +-- copyright 2023 +-- license GNU General Public License v3.0 local M = {} @@ -14,7 +13,6 @@ M.config = require "astroui.config" --- Setup and configure AstroUI ---@param opts AstroUIConfig ----@see astroui.config function M.setup(opts) M.config = vim.tbl_deep_extend("force", M.config, opts) diff --git a/lua/astroui/status.lua b/lua/astroui/status.lua index 869336b..d2b3487 100644 --- a/lua/astroui/status.lua +++ b/lua/astroui/status.lua @@ -1,13 +1,11 @@ ---- ### AstroNvim Status Utilities +-- AstroNvim Status Utilities -- -- Status utility functions to use within AstroNvim and user configurations. -- -- This module can be loaded with `local astro = require "astroui.status"` -- --- @module astroui.status --- @see astroui --- @copyright 2023 --- @license GNU General Public License v3.0 +-- copyright 2023 +-- license GNU General Public License v3.0 return { --- @see astroui.status.component diff --git a/lua/astroui/status/component.lua b/lua/astroui/status/component.lua index 76433b4..9f8eca1 100644 --- a/lua/astroui/status/component.lua +++ b/lua/astroui/status/component.lua @@ -1,12 +1,11 @@ ---- ### AstroNvim Status Components +-- AstroNvim Status Components -- -- Statusline related component functions to use with Heirline -- -- This module can be loaded with `local component = require "astroui.status.component"` -- --- @module astroui.status.component --- @copyright 2023 --- @license GNU General Public License v3.0 +-- copyright 2023 +-- license GNU General Public License v3.0 local M = {} diff --git a/lua/astroui/status/condition.lua b/lua/astroui/status/condition.lua index 9709785..36cdb60 100644 --- a/lua/astroui/status/condition.lua +++ b/lua/astroui/status/condition.lua @@ -1,12 +1,11 @@ ---- ### AstroNvim Status Conditions +-- AstroNvim Status Conditions -- -- Statusline related condition functions to use with Heirline -- -- This module can be loaded with `local condition = require "astroui.status.condition"` -- --- @module astroui.status.condition --- @copyright 2023 --- @license GNU General Public License v3.0 +-- copyright 2023 +-- license GNU General Public License v3.0 local M = {} diff --git a/lua/astroui/status/heirline.lua b/lua/astroui/status/heirline.lua index 23bc024..de711db 100644 --- a/lua/astroui/status/heirline.lua +++ b/lua/astroui/status/heirline.lua @@ -1,12 +1,11 @@ ---- ### AstroNvim Status Heirline Extensions +-- AstroNvim Status Heirline Extensions -- -- Statusline related heirline specific extensions -- -- This module can be loaded with `local astro_heirline = require "astroui.status.heirline"` -- --- @module astroui.status.heirline --- @copyright 2023 --- @license GNU General Public License v3.0 +-- copyright 2023 +-- license GNU General Public License v3.0 local M = {} diff --git a/lua/astroui/status/hl.lua b/lua/astroui/status/hl.lua index c7f45c8..af76ecb 100644 --- a/lua/astroui/status/hl.lua +++ b/lua/astroui/status/hl.lua @@ -1,12 +1,11 @@ ---- ### AstroNvim Status Highlighting +-- AstroNvim Status Highlighting -- -- Statusline related highlighting utilities -- -- This module can be loaded with `local hl = require "astroui.status.hl"` -- --- @module astroui.status.hl --- @copyright 2023 --- @license GNU General Public License v3.0 +-- copyright 2023 +-- license GNU General Public License v3.0 local M = {} diff --git a/lua/astroui/status/init.lua b/lua/astroui/status/init.lua index 310bc88..564b263 100644 --- a/lua/astroui/status/init.lua +++ b/lua/astroui/status/init.lua @@ -1,12 +1,11 @@ ---- ### AstroNvim Status Initializers +-- AstroNvim Status Initializers -- -- Statusline related init functions for building dynamic statusline components -- -- This module can be loaded with `local init = require "astroui.status.init"` -- --- @module astroui.status.init --- @copyright 2023 --- @license GNU General Public License v3.0 +-- copyright 2023 +-- license GNU General Public License v3.0 local M = {} diff --git a/lua/astroui/status/provider.lua b/lua/astroui/status/provider.lua index 9cf522f..29dd55e 100644 --- a/lua/astroui/status/provider.lua +++ b/lua/astroui/status/provider.lua @@ -1,12 +1,11 @@ ---- ### AstroNvim Status Providers +-- AstroNvim Status Providers -- -- Statusline related provider functions for building statusline components -- -- This module can be loaded with `local provider = require "astroui.status.provider"` -- --- @module astroui.status.provider --- @copyright 2023 --- @license GNU General Public License v3.0 +-- copyright 2023 +-- license GNU General Public License v3.0 local M = {} diff --git a/lua/astroui/status/utils.lua b/lua/astroui/status/utils.lua index 31f9bcf..8975004 100644 --- a/lua/astroui/status/utils.lua +++ b/lua/astroui/status/utils.lua @@ -1,12 +1,11 @@ ---- ### AstroNvim Status Utilities +-- AstroNvim Status Utilities -- -- Statusline related uitility functions -- -- This module can be loaded with `local status_utils = require "astroui.status.utils"` -- --- @module astroui.status.utils --- @copyright 2023 --- @license GNU General Public License v3.0 +-- copyright 2023 +-- license GNU General Public License v3.0 local M = {} diff --git a/lua/astroui/types.lua b/lua/astroui/types.lua deleted file mode 100644 index d43a7ff..0000000 --- a/lua/astroui/types.lua +++ /dev/null @@ -1,31 +0,0 @@ ----@meta - ----@alias AstroUIIconHighlight (fun(self:table):boolean)|boolean ----@alias AstroUIIconTable table - ----@class AstroUIFullIconHighlights ----@field tabline AstroUIIconHighlight? ----@field statusline AstroUIIconHighlight? ----@field winbar AstroUIIconHighlight? - ----@class AstroUIIconHighlights ----@field breadcrumbs AstroUIIconHighlight? ----@field file_icon AstroUIFullIconHighlights? - ----@class AstroUIStatusOpts ----@field attributes table? ----@field buf_matchers table? ----@field colors table? ----@field fallback_colors table? ----@field icon_hignlights AstroUIIconHighlights? ----@field modes table? ----@field separators table? ----@field setup_colors (fun():table)? ----@field sign_handlers table? - ----@class AstroUIConfig ----@field colorscheme string? ----@field highlights table>? ----@field icons AstroUIIconTable? ----@field text_icons AstroUIIconTable? ----@field status AstroUIStatusOpts?