refactor of public plugin's api (#37)

* refactor: move all plugin functionality to init.lua

* fix(commands): now it uses correct module paths

* refactor(config): change way how it handles options

* refactor(gotests): use correct config, change way how deps required, fix some typos

* fix(healthchecker): use correct config

* refactor(iferr): change api

* refactor(impl): change api

* refactor(installer): change api

* refactor(struct_tags): change way of importting deps

* refactor(struct_tags): rename M to struct_tags

* run stylua

* refactor(dap): make it all in one file, and make some refactoring

* refactor(_utils): change way how it organizes

* fix: use new _utils api

* refactor(_utils.health): reorganize module

* refactor(_utils.ts): some renameing, moving requires lines

* run stylua
This commit is contained in:
Smirnov Oleksandr 2023-07-19 23:38:23 +03:00 committed by GitHub
parent 94250bb08a
commit 26b41bf68c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 359 additions and 341 deletions

View file

@ -1,33 +1,27 @@
---@class Config
---@field commands ConfigCommands
---@class gopher.Config
local config = {}
---@class ConfigCommands
---@field go string
---@field gomodifytags string
---@field gotests string
---@field impl string
---@field iferr string
---@field dlv string
local M = {
---@type Config
config = {
---set custom commands for tools
commands = {
go = "go",
gomodifytags = "gomodifytags",
gotests = "gotests",
impl = "impl",
iferr = "iferr",
dlv = "dlv",
},
---@class gopher.Config
---@field commands gopher.ConfigCommands
local default_config = {
---@class gopher.ConfigCommands
commands = {
go = "go",
gomodifytags = "gomodifytags",
gotests = "gotests",
impl = "impl",
iferr = "iferr",
dlv = "dlv",
},
}
---Plugin setup function
---@param opts Config user config
function M.setup(opts)
M.config = vim.tbl_deep_extend("force", M.config, opts or {})
---@param user_config gopher.Config|nil
function config.setup(user_config)
config = vim.tbl_deep_extend("force", {}, default_config, user_config or {})
end
return M
-- setup ifself, needs for ability to get
-- default config without calling .setup()
config.setup()
return config