Skip to content

Commit

Permalink
feat: add types for autocompletion with lua_ls
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Aug 2, 2023
1 parent ee6f4ba commit 63ed189
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions lua/astrocore/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-- @copyright 2023
-- @license GNU General Public License v3.0

---@type AstroCoreConfig
return {
autocmds = {},
commands = {},
Expand Down
3 changes: 3 additions & 0 deletions lua/astrocore/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,9 @@ function M.file_worktree(file, worktrees)
end
end

--- Setup and configure AstroCore
---@param opts AstroCoreConfig
---@see astrocore.config
function M.setup(opts)
M.config = vim.tbl_deep_extend("force", M.config, opts)

Expand Down
38 changes: 38 additions & 0 deletions lua/astrocore/types.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---@meta

---@class AstroCoreMaxFile
---@field size integer?
---@field lines integer?

---@class AstroCoreFeatureOpts
---@field autopairs boolean?
---@field cmp boolean?
---@field highlighturl boolean?
---@field max_file AstroCoreMaxFile?
---@field notifications boolean?

---@class AstroCoreSessionAutosave
---@field last boolean?
---@field cwd boolean?

---@class AstroCoreSessionIgnore
---@field dirs string[]?
---@field filetypes string[]?
---@field buftypes string[]?

---@class AstroCoreSessionOpts
---@field autosave AstroCoreSessionAutosave?
---@field ignore AstroCoreSessionIgnore?

---@class GitWorktree
---@field toplevel string
---@field gitdir string

---@class AstroCoreConfig
---@field autocmds table<string,table[]>?
---@field commands table<string,table>?
---@field mappings table<string,table<string,table|boolean>>?
---@field on_keys table<string,fun(key:string)[]>?
---@field features AstroCoreFeatureOpts?
---@field git_worktrees GitWorktree[]?
---@field sessions AstroCoreSessionOpts?

1 comment on commit 63ed189

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.