[mirror] Make your go dev experience better
github.com/olexsmir/gopher.nvim
neovim
golang
1---@toc_entry Configuration
2---@tag gopher.nvim-config
3---@text config it is the place where you can configure the plugin.
4--- also this is optional is you're ok with default settings.
5--- You can look at default options |gopher.nvim-config-defaults|
6
7---@type gopher.Config
8---@private
9local config = {}
10
11---@tag gopher.nvim-config.ConfigGoTagTransform
12---@text Possible values for |gopher.Config|.gotag.transform:
13---
14---@private
15---@alias gopher.ConfigGoTagTransform
16---| "snakecase" "GopherUser" -> "gopher_user"
17---| "camelcase" "GopherUser" -> "gopherUser"
18---| "lispcase" "GopherUser" -> "gopher-user"
19---| "pascalcase" "GopherUser" -> "GopherUser"
20---| "titlecase" "GopherUser" -> "Gopher User"
21---| "keep" keeps the original field name
22
23--minidoc_replace_start {
24
25---@tag gopher.nvim-config-defaults
26---@eval return MiniDoc.afterlines_to_code(MiniDoc.current.eval_section)
27---
28---@class gopher.Config
29local default_config = {
30 --minidoc_replace_end
31
32 -- log level, you might consider using DEBUG or TRACE for debugging the plugin
33 ---@type number
34 log_level = vim.log.levels.INFO,
35
36 -- user specified paths to binaries
37 ---@class gopher.ConfigCommand
38 commands = {
39 go = "go",
40 gomodifytags = "gomodifytags",
41 gotests = "gotests",
42 impl = "impl",
43 iferr = "iferr",
44 dlv = "dlv",
45 },
46 ---@class gopher.ConfigGotests
47 gotests = {
48 -- gotests doesn't have template named "default" so this plugin uses "default" to set the default template
49 template = "default",
50 -- path to a directory containing custom test code templates
51 ---@type string|nil
52 template_dir = nil,
53 -- switch table tests from using slice to map (with test name for the key)
54 -- works only with gotests installed from develop branch
55 named = false,
56 },
57 ---@class gopher.ConfigGoTag
58 gotag = {
59 ---@type gopher.ConfigGoTagTransform
60 transform = "snakecase",
61 },
62}
63--minidoc_afterlines_end
64
65---@type gopher.Config
66---@private
67local _config = default_config
68
69-- I am kinda secret so don't tell anyone about me even dont use me
70--
71-- if you don't believe me that i am secret see
72-- the line below it says @private
73---@private
74_config.___plugin_name = "gopher.nvim" ---@diagnostic disable-line: inject-field
75
76---@param user_config? gopher.Config
77---@private
78function config.setup(user_config)
79 _config = vim.tbl_deep_extend("force", default_config, user_config or {})
80end
81
82setmetatable(config, {
83 __index = function(_, key)
84 return _config[key]
85 end,
86})
87
88return config