From ec13e0f44fd8f2920c291cb60aa745da1e59148e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 5 Sep 2022 16:56:58 +0200 Subject: [PATCH] style: added lua annotations to init methods --- lua/tokyonight/config.lua | 2 ++ lua/tokyonight/init.lua | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/lua/tokyonight/config.lua b/lua/tokyonight/config.lua index 682db58..f2b4eff 100644 --- a/lua/tokyonight/config.lua +++ b/lua/tokyonight/config.lua @@ -25,10 +25,12 @@ local defaults = { ---@type Config M.options = {} +---@param options Config|nil function M.setup(options) M.options = vim.tbl_deep_extend("force", {}, defaults, options or {}) end +---@param options Config|nil function M.extend(options) M.options = vim.tbl_deep_extend("force", {}, M.options or defaults, options or {}) end diff --git a/lua/tokyonight/init.lua b/lua/tokyonight/init.lua index 6cd4ec0..4571503 100644 --- a/lua/tokyonight/init.lua +++ b/lua/tokyonight/init.lua @@ -1,8 +1,10 @@ local util = require("tokyonight.util") local theme = require("tokyonight.theme") +local config = require("tokyonight.config") local M = {} +---@param opts Config|nil function M.load(opts) if opts then require("tokyonight.config").extend(opts) @@ -10,6 +12,9 @@ function M.load(opts) util.load(theme.setup()) end +M.setup = config.setup + +-- keep for backward compatibility M.colorscheme = M.load return M